Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullable ref schema #509

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Fix nullable ref schema #509

merged 1 commit into from
Mar 9, 2023

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Mar 9, 2023

This commit adds support for correct $ref schema nullable fields. Optioal type field e.g. book: Option<Book> will be rendered as nullable allOf field so client side generators can create correct client and types from the generated openapi.json.

 "book": {
     "nullable": true,
     "allOf": [
         {
             "$ref": "#/components/schemas/Book"
         }
     ]
 }

Fixes #314

This commit adds support for correct $ref schema nullable fields.
Optioal type field e.g. `book: Option<Book>` will be rendered as nullable
allOf field so client side generators can create correct client and types
from the generated openapi.json.
```json
 "book": {
     "nullable": true,
     "allOf": [
         {
             "$ref": "#/components/schemas/Book"
         }
     ]
 }
```
@juhaku juhaku merged commit 1fbe015 into master Mar 9, 2023
@juhaku juhaku deleted the fix-nullable-ref-schema branch March 9, 2023 23:23
joaommartins added a commit to franklin-ai/utoipa that referenced this pull request Mar 10, 2023
This commit adds support for correct $ref schema nullable fields.
Optioal type field e.g. `book: Option<Book>` will be rendered as nullable
allOf field so client side generators can create correct client and types
from the generated openapi.json.
```json
 "book": {
     "nullable": true,
     "allOf": [
         {
             "$ref": "#/components/schemas/Book"
         }
     ]
 }
```

Co-authored-by: Juha Kukkonen <juha7kukkonen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

Support for nullable fields
1 participant