Crates.io | openapi-31 |
lib.rs | openapi-31 |
version | 0.4.0 |
source | src |
created_at | 2024-03-14 22:16:54.426221 |
updated_at | 2024-03-16 19:42:45.378734 |
description | OpenAPI v3.1 Specification |
homepage | https://github.com/zaghaghi/openapi-tui |
repository | https://github.com/zaghaghi/openapi-tui |
max_upload_size | |
id | 1174209 |
size | 90,144 |
The idea is to use openapi code generator for rust to generate openapi specification library. To do so, I started with an openapi specification with
{
"openapi": "3.1.0",
"info": {
"version": "3.1.0",
"title": "openapi"
},
"components": {
"schemas": {}
}
}
schema.$def
into the above OpenAPI json inside components.schemas
openapi
definition into components.schemas
#/$defs/
with #/componenst/schemas
"$ref": "#/$defs/specification-extensions"
. We don't need them now.oneOf
. We will add them later in the generated code.See the result file here.
npx -y @openapitools/openapi-generator-cli generate -i openapi-in-openapi.json -g rust -o /tmp/openapi && mv /tmp/openapi/src/models .
Generated code is not complete, and don't generate these structs. We will create them by hand :-) .
path-item-or-reference
parameter-or-reference
request-body-or-reference
response-or-reference
callbacks-or-reference
example-or-reference
link-or-reference
header-or-reference
security-scheme-or-reference