GREsau / GREsau/okapi

Using openapi3::OpenApi with schemars alpha version

Open
#160 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
740
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Hello!

My goal is to produce an OpenApi spec using schemars.

I have a code:
```rust
let my_schemas: okapi::Map:: = ... // generated by schemars ^0.8

OpenApi {
openapi: "3.0.0".to_string(),
info: okapi::openapi3::Info {
title: "My API".to_string(),
version: "1.0.0".to_string(),
..Default::default()
},
components: Some(okapi::openapi3::Components {
schemas: my_schemas,
..Default::default()
}),
..Default::default()
}
```
Which works perfectly with `schemars ^0.8`.

However, I would like to use `schemars 1.0.0-alpha.17` as it has [better](https://github.com/GREsau/schemars/issues/165) enum support and seems it has more useful features.

There is a problem. Now `my_schemas` type would be `Schema(Value)` from alpha version which is not compatible with `OpenApi::components::schemas` type `Map` as `schemars ^0.8` generate except manually implementing that transformation which can be quirky. Another option I see is to generate pure json instead of using openapiv3::OpenApi

Could you please suggest a pretty solution for this issue?

cc @GREsau

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.