Skip to content

Missing codes in the errors union #1820

Closed
@pstachula-dev

Description

@pstachula-dev

Description

It seems that the library generated error types and returns only the first error code instead of the union for the other types. When we have declared other error codes for 401 and 404, only 401 is returned.

Reproduction

           200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["CatFact"];
                };
            };

            /** @description error 401 */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["ErrorUnauthorized"];
                };
            };
            /** @description error 403 */
            403: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["ErrorForbidden"];
                };
            };
            /** @description not found */
            404: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };

Full schema: https://pastebin.com/aBhmzfE2

As far as I can see, the errors are sorted in ascending order and only the first one is taken into account, the others are omitted.
image

Expected result

Union of all errors 401, 403, 403...

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-fetchRelevant to the openapi-fetch library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions