Extending Commands
Last updated on
27 October 2022
You may need to define multiple Commands sharing some properties.
Instead of defining again the same properties for all commands you could define a base command and let the other ones extending it.
operations:
SearchCommandBase:
summary: "Abstract Search Command"
parameters:
content-type:
location: "header"
default: "application/json"
query:
type: "string"
location: "query"
description: "The search query."
required: false
default: null
page:
type: "integer"
location: "query"
description: "The result page."
required: false
default: 1
size:
type: "integer"
location: "query"
description: "The number of items per page."
required: false
default: 10
responseModel: "SearchResponse"
SearchPosts:
httpMethod: "GET"
uri: "search/posts"
summary: "Search for posts"
extends: "SearchCommandBase"
SearchComments:
httpMethod: "GET"
uri: "search/comments"
summary: "Search for posts"
extends: "SearchCommandBase"
The extends property is used to extend from another operation by name. The parent operation must be defined before the child.
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion