-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate arrays with an optional element type for arrays with nullabl…
…e items (#492) ### Motivation Array items can be nullable. When this is the case, the element type of the generated array should be optional. Today it is not. For example, consider the following OpenAPI snippet: ```yaml StringArrayNullableItems: type: array items: type: [string, null] ``` This currently generates a type alias for `[String]` but it should be `[String?]` ### Modifications Update the translator to take into account `arrayContext.items.nullable` when generating the types for array values. ### Result Arrays with nullable items ### Test Plan - Snippet test for standalone schema. - Snippet test for use within an object. - A test that shows lossless conversion to JSON with Foundation. ### Related issues - Fixes #444.
- Loading branch information
1 parent
cd88cbe
commit 76994bf
Showing
4 changed files
with
181 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters