Skip to content
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

Add operationId as part of Paths #446

Open
henhal opened this issue Sep 15, 2020 · 1 comment
Open

Add operationId as part of Paths #446

henhal opened this issue Sep 15, 2020 · 1 comment

Comments

@henhal
Copy link

henhal commented Sep 15, 2020

In some situations it might be useful to include the operationId of each operation in the generated types, as a const ID value.

For example I'm considering writing a dtsgen plugin that emits a map of operationId to request body+response body types, but when the plugin is invoked, the operationId is gone.

Example:

  /foo:
    post:
      operationId: addFoo
      ...

Current generated type:

    namespace AddFoo {
        export interface HeaderParameters {
        }
        namespace Parameters {
        }
        export type RequestBody = ...
        namespace Responses {
            export interface $200 {
                ...
            }
        }
    }

Suggested:

    namespace AddFoo {
        export const ID = 'addFoo';
        export interface HeaderParameters {
        }
        namespace Parameters {
        }
        export type RequestBody = ...
        namespace Responses {
            export interface $200 {
            }
        }
    }

An even more powerful solution might be to include the original JSON schema as part of the context passed to plugins, if possible, then plugins would be able to do more advanced tweaking of the output also using data from the input schema.

@horiuchi
Copy link
Owner

This is the kind of content that a plugin would be suited for.

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

No branches or pull requests

2 participants