Add examples to openapi definition

Signed-off-by: ivgo <ivgo@spreadgroup.com>
This commit is contained in:
ivgo
2023-08-28 09:10:21 +02:00
parent c18f7ab7e9
commit acffa17027
3 changed files with 85 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Added some examples to the catalog OpenAPI definition
@@ -111,6 +111,14 @@ export const spec = {
type: 'string',
},
},
examples: {
'Get name and the entire relations collection': {
value: ['metadata.name', 'relations'],
},
'Get kind, name and namespace': {
value: ['kind', 'metadata.name', 'metadata.namespace'],
},
},
},
filter: {
name: 'filter',
@@ -124,6 +132,16 @@ export const spec = {
type: 'string',
},
},
examples: {
'Get groups': {
value: ['kind=group'],
},
'Get orphaned components': {
value: [
'kind=component,metadata.annotations.backstage.io/orphan=true',
],
},
},
},
offset: {
name: 'offset',
@@ -162,6 +180,14 @@ export const spec = {
},
explode: true,
style: 'form',
examples: {
'Order ascending by name': {
value: ['metadata.name,asc'],
},
'Order descending by owner': {
value: ['spec.owner,desc'],
},
},
},
},
requestBodies: {},
@@ -1010,6 +1036,22 @@ export const spec = {
},
},
},
examples: {
'Fetch Backstage entities': {
value: {
entityRefs: [
'component:default/backstage',
'api:default/backstage',
],
},
},
'Fetch annotations for backstage entity': {
value: {
entityRefs: ['component:default/backstage'],
fields: ['metadata.annotations'],
},
},
},
},
},
},
@@ -1116,6 +1158,14 @@ export const spec = {
type: 'string',
},
},
examples: {
'Entities by kind': {
value: ['kind'],
},
'Entities by spec type': {
value: ['spec.type'],
},
},
},
{
$ref: '#/components/parameters/filter',
@@ -72,6 +72,11 @@ components:
type: array
items:
type: string
examples:
'Get name and the entire relations collection':
value: ['metadata.name', 'relations']
'Get kind, name and namespace':
value: ['kind', 'metadata.name', 'metadata.namespace']
filter:
name: filter
in: query
@@ -82,6 +87,12 @@ components:
type: array
items:
type: string
examples:
'Get groups':
value: ['kind=group']
'Get orphaned components':
value:
['kind=component,metadata.annotations.backstage.io/orphan=true']
offset:
name: offset
in: query
@@ -113,6 +124,11 @@ components:
description: A two-item tuple of [field, order].
explode: true
style: form
examples:
'Order ascending by name':
value: ['metadata.name,asc']
'Order descending by owner':
value: ['spec.owner,desc']
requestBodies: {}
responses: {}
schemas:
@@ -781,6 +797,15 @@ paths:
type: array
items:
type: string
examples:
'Fetch Backstage entities':
value:
entityRefs:
['component:default/backstage', 'api:default/backstage']
'Fetch annotations for backstage entity':
value:
entityRefs: ['component:default/backstage']
fields: ['metadata.annotations']
/entities/by-query:
get:
operationId: GetEntitiesByQuery
@@ -842,6 +867,11 @@ paths:
type: array
items:
type: string
examples:
'Entities by kind':
value: ['kind']
'Entities by spec type':
value: ['spec.type']
- $ref: '#/components/parameters/filter'
/locations:
post: