-
Notifications
You must be signed in to change notification settings - Fork 146
Support type: 'null'
with anyOf and oneOf
#831
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
Open
dpasirst
wants to merge
10
commits into
apple:main
Choose a base branch
from
dpasirst:removing_null
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+456
−4
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c70e4f6
feat: enable (hacky) handling for anyOf and oneOf containing null
dpasirst a4fa39b
chore: formating changes
dpasirst 6d7f534
chore: update comment only
dpasirst def1390
fix: I think we can use the built-in nullableContext
dpasirst 6ec897b
chore: improve feat integration point
dpasirst ff3edb6
feat: implement snippet tests
dpasirst ed88d9c
fix: comment said remove twice
dpasirst 491a8a2
fix: remove unnecessary return
dpasirst 75d22ac
chore: refactor simplify using existing nullableSchemaObject()
dpasirst dadc09d
chore: update comments only
dpasirst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add a whole new reference project, that's considerably expensive to maintain.
Could you instead look into the snippet tests we have? You can add test cases there, and those are more focused and easier to maintain.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started creating some snippet tests, but I'm quickly noticing that snippet tests bypass the
GeneratorPipeline
, which is where I currently hooked up the code modifying the parsed document. Thus, my code is not being triggered by those tests. Perhaps that is not the best place for my code to perform the function? Any suggestions?alternately, I can modify the
makeTypesTranslator()
in snippets to call the extension similar to how it is connected in theGeneratorPipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah let's see, maybe move it to makeGeneratorPipeline, where we already have other pre-processing steps:
swift-openapi-generator/Sources/_OpenAPIGeneratorCore/GeneratorPipeline.swift
Line 111 in c6e8513
For testing, some unit tests validating that the stripping of the
null
works correctly will be a great start, and then you can add a few examples of such schemas into the existing Petstore file-based reference tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed an update to this PR, which I hope addresses your feedback. I feel pretty comfortable with the basic case of:
but I personally have not worked with cases like:
To me, the output in the snippet tests looks about correct, but I would hope someone more familiar could verify it.