Skip to content

Add example property to Components #270

@ehubbell

Description

@ehubbell

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": "user@example.com",
	 * 				"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=steve@apple.com] - The email for the user
 * @property {string} [tagline=Innovator] - The tagline for the user
 * @property {string} [description=lorem ipsum...] - The description for the user
 */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions