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 example property to Components #270

Open
ehubbell opened this issue Jul 11, 2024 · 0 comments
Open

Add example property to Components #270

ehubbell opened this issue Jul 11, 2024 · 0 comments

Comments

@ehubbell
Copy link

In reviewing the documentation and examples, it doesn't look like there is a way to add the example property to a Component. The OpenAPI spec supports this and several UI's rely on it to decorate response blocks. Please see the attached image for reference.

Swagger Editor Example

https://editor.swagger.io/
CleanShot 2024-07-11 at 11 13 22

As a result, the only way to decorate each response is adding an example block like so:

	/**
	 * POST /login
	 * @summary Login user
	 * @description Login to your account
	 * @param {string} email.form.required - The email address on file.
	 * @param {string} password.form.required - The email address on file.
	 * @tags Auth
	 * @return {Session} 200 - Success - application/json
	 * @example request - payload example
	 * {
	 * 		"data": {
	 * 			"attributes: {
	 * 				"email": "[email protected]",
	 * 				"password": "******"
	 * 			}
	 * 		}
	 * }
	 */

It would be nice if we could add default or example values when defining a Component like so:

/**
 * User data
 * @typedef {object} User
 * @property {integer} [id=1] - An auto-increment identifier
 * @property {string} [status=active] - The status of the user
 * @property {string} [thumbnail=https://www.filestack.com/photo.jpg] - The thumbnail for the user
 * @property {string} [name=Steve Jobs] - The name for the user
 * @property {string} [uuid=steve-jobs] - The uuid for the user
 * @property {string} [[email protected]] - The email for the user
 * @property {string} [tagline=Innovator] - The tagline for the user
 * @property {string} [description=lorem ipsum...] - The description for the user
 */
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

1 participant