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

pluginTs: enhance javascript doc with data from schema #1470

Closed
nimo23 opened this issue Dec 15, 2024 · 0 comments · Fixed by #1472
Closed

pluginTs: enhance javascript doc with data from schema #1470

nimo23 opened this issue Dec 15, 2024 · 0 comments · Fixed by #1472
Assignees
Labels
enhancement New feature or request

Comments

@nimo23
Copy link

nimo23 commented Dec 15, 2024

What is the problem this feature would solve?

Does it make sense to add the validation rules defined in “openapi.yaml” to the JS Doc of the generated types/interfaces?

For example, having a user.json-schema with a username-property:

	"username" : {
		"type" : "string",
		"description" : "The username",
		"pattern" : "\\S",
		"minLength" : 2,
		"maxLength" : 20
	},

will generate the following JS Doc:

  /**
   * @description The username
   * @type string
   */
  username: string

Would be nice to enhance the JS Doc (maybe by a setting in pluginTs) to the following (btw, orval does this also):

  /**
   * The username
   * 
   * @type string
   * @minLength 2
   * @maxLength 20
   * @pattern \S
   */
  username: string;

This can be achieved by adding each schema tag to the generated JS document in the following format:

  /**
   * @[tag] [value]
   */

External documents/projects?

No response

What is the feature you are proposing to solve the problem?

The enhanced JavaScript Doc allows the user to see the validation rules immediately via the API (without having to dig into openapi.yaml).

What alternatives have you considered?

No response

@nimo23 nimo23 added the enhancement New feature or request label Dec 15, 2024
@stijnvanhulle stijnvanhulle self-assigned this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants