-
Notifications
You must be signed in to change notification settings - Fork 102
New response type #391
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
New response type #391
Conversation
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.
LGTM
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.
The changes look good from looking over all the TypeScript changes :)
/** | ||
* The absence of any type. This is commonly used in APIs that returns an empty body. | ||
*/ | ||
export class VoidValue { | ||
kind: 'void_value' | ||
} | ||
|
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.
Late review of this PR... IMHO we should remove this newly introduced VoidValue
.
void
is not a value, it's the absence of value (which is different from null
and undefined
that are values). As such a property cannot be of type void, but adding it to the ValueOf
enumeration makes it possible.
We already have a simpler means to represent requests and responses with an empty body (or more exactly no body, as an empty body could be {}
): the body
property is optional: body?: ValueBody | PropertiesBody
. If it's not specified, then the request or response has no body.
Or was this introduced so that body-less requests and responses are explicitly represented in the spec? In that case we should make the body property a required field and add a 3rd alternative: body: ValueBody | PropertiesBody | VoidBody
This pr introduces the new Reponse type as outlined here.
To keep the specification consistent and actionable it also changes the following:
EmptyResponseBase
andArrayResponseBase
behaviors.Closes: #359 #361