Changes "void_value" into "no_body" for req/responses with no body #444
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.
Follow-up to #391 (comment)
This PR changes the way we represent no-body responses (and requests) in
schema.json
:body
property is now requiredNoBody
in addition to the existingPropertyBody | ValueBody
void_value
value kind has been removed (it doesn't make sense for a property to be of type void)We also formalize the the close relation between body type and inheritance: when a request or response extends a class, the parent class defines body properties inherited by the child class. The child class therefore has to have a
PropertyBody
.The body is required in the schema but is still optional in the spec (ultimately we should enforce it), and a simple heuristic is used to find the correct body type when it's not present in the TS spec:
PropertyBody
with an emptu list of propertiesNoBody
New validations verify this.
Aside:
There are changes in the schema with the new body type, but the TS output has no change except some formatting that is a side effect of
body
now being required.