Skip inferred properties #381
Merged
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.
Motivation
Fixes #379.
Context:
If you define an object schema as follows:
OpenAPIKit will parse it as having two properties:
aof typestringandbbeing a fragment, withaoptional andbrequired.Unfortunately, often property names appear only in the
requiredlist as a result of a typo, leading to non-compiling code and a difficult debugging story.It comes down to the fact that Swift OpenAPI Generator never officially supported defining properties this way, and continues not to.
If adopters want to do this intentionally, they should do this:
Modifications
This PR tightens the rules around inferred properties:
agenerated, and the second example bothaandb.inferredproperty was added just yesterday.Result
Less likely typos and mismatch between
propertiesandrequired, and a diagnostic to help debug this case.Test Plan
Added a snippet test.