Skip to content

Support for non-200/201 status #123

@devcsrj

Description

@devcsrj

In the README, the following caveat is stated:

Only "200" and "201" responses are inspected for determining the expected return value for RPC endpoints.

Are there plans to support responses from other statuses?

I believe this can be achieved using the oneof construct. For example, instead of:

message FindPetsByIdsResponse {
    message PetsMessage {
        int64 id = 1;
        string name = 2;
        string tag = 3;
    }

    repeated PetsMessage pets = 1;
}

Assuming there's no $ref on the status code 404, this will become:

message FindPetsByIdsResponse {
    message Message200 {
        int64 id = 1;
        string name = 2;
        string tag = 3;
    }
    message Message404 {
    }

    oneof responses {
        repeated Message200 pets = 1;
        Message404 = 2;
    }
}

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions