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

Anyway to override the Example text in the generated Swagger output? #885

Open
cuda opened this issue Mar 7, 2024 · 3 comments
Open

Anyway to override the Example text in the generated Swagger output? #885

cuda opened this issue Mar 7, 2024 · 3 comments

Comments

@cuda
Copy link

cuda commented Mar 7, 2024

Hi All,

Is there any way to override the Example text in the generated Swagger output?

For example,
image

Here, the filter only supports $eq, and I want to add a relevant example, such as:
Example: filter.service=$eq:SMS

Thanks,
Marcus

@cuda
Copy link
Author

cuda commented Mar 9, 2024

Adding a @apiquery after @ApiPagniationQuery seems to do work

@ApiPaginationQuery(RecipientPaginationConfig)
@ApiQuery({
    name: 'filter.service',
    required: false,
    type: String,
    isArray: true,
    description: `Filter by id query param.
          ${p('Format', `filter.service={$not}:OPERATION:VALUE`)}
          ${p('Example', `filter.service=$eq:SMS`)}
          ${li('Available Operations', ['$eq'])}`
  })

(of course, defining the functions p and li as in lib)

This overwrites the generated one in the output

Minor hiccup: If you don't override all the filters, they are not listed together, with a page and limit between the ones you overwrote and the ones you generated.

@Helveg

This comment was marked as resolved.

@Helveg
Copy link
Collaborator

Helveg commented Mar 9, 2024

Currently, by looking at the source code, there is no way provided by the package to override this. Perhaps we can provide more fine grained decorators, or configuration to the decorators, for overriding parts of the Swagger output?

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