Skip to content

Improved support for multiple response types/204 no content #10

Open
@EventuallyEven

Description

@EventuallyEven

Given the following definition

"/someurl": {
  "get": {
	"operationId": "someId",
	"tags": ["tag"],
	"parameters": [
	  {
		"name": "thing",
		"in": "path",
		"required": true,
		"schema": {
		  "type": "string"
		}
	  }
	],
	"responses": {
	  "200": {
		"description": "Yes",
		"content": {
		  "application/json": {
			"schema": {
			  "$ref": "someschema"
			}
		  }
		}
	  },
	  "204": {
		"description": "Empty"
	  }
	}
  }
}

we get the following interface method in the api

someId(params: {
        pathParams: { thing: string };
    }): Promise<someschema>;

The ACTUAL values that can be returned are someschema OR a Response object with status 204.
It would be preferable for the api to reflect this, or, even better, if the actual return value was
someschema or void, i.e.

someId(params: {
        pathParams: { thing: string };
    }): Promise<someschema | void>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions