Skip to content

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

Merged
merged 9 commits into from
Apr 29, 2021
Merged

New response type #391

merged 9 commits into from
Apr 29, 2021

Conversation

delvedor
Copy link
Member

@delvedor delvedor commented Apr 28, 2021

This pr introduces the new Reponse type as outlined here.

To keep the specification consistent and actionable it also changes the following:

  • Removes the EmptyResponseBase and ArrayResponseBase behaviors.
  • Adds support for the Void custom type
  • Adds the support to have response body as generic
  • Removes the legacy ResponseBase class

Closes: #359 #361

@delvedor delvedor requested a review from a team April 28, 2021 07:36
@philkra philkra self-requested a review April 28, 2021 13:35
Copy link
Contributor

@philkra philkra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@sethmlarson sethmlarson left a 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 :)

Comment on lines +119 to +125
/**
* The absence of any type. This is commonly used in APIs that returns an empty body.
*/
export class VoidValue {
kind: 'void_value'
}

Copy link
Member

@swallez swallez May 4, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_source response must return generic
4 participants