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

Allow support other formats on strings with a plugin #6131

Closed
jclx opened this issue Jun 11, 2020 · 1 comment
Closed

Allow support other formats on strings with a plugin #6131

jclx opened this issue Jun 11, 2020 · 1 comment
Labels

Comments

@jclx
Copy link

@jclx jclx commented Jun 11, 2020

Content & configuration

Swagger/OpenAPI definition:

{
 "StartDate" : {
      "format" : "local-date-time",
      "type" : "string"
   }
}

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Is your feature request related to a problem?

Support for additional formats on strings other than those provide.

Describe the solution you'd like

Add support for a plugin to provide sample values for different formats other than default supplied.
In /swagger-ui/src/core/plugins/samples/fn.js , support for string_date-time is an example.
the format local-date-time is a custom format. Adding plugin could provide for other formats than the default provided. This could also support when an regexp is used for the format.

Describe alternatives you've considered

Additional context

Also having some context like name of field could allow different sample values.

@tim-lai
Copy link
Contributor

@tim-lai tim-lai commented Oct 6, 2020

@jclx The SwaggerUI Plugin API is available to the community for the reasons you cited. If you have a helpful plugin to share with the community, please feel free to create a PR. Thanks.

@tim-lai tim-lai closed this Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.