Skip to content

Commit

Permalink
refactor: Move common parameters to components
Browse files Browse the repository at this point in the history
Common header and path parameters are now in `'#/components/parameters`.
The `XRhInsightsRequestIdHeader` is now optional for all routes.

Signed-off-by: Christian Heimes <[email protected]>
  • Loading branch information
tiran committed Aug 30, 2023
1 parent 6b13889 commit 1a5760d
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 180 deletions.
154 changes: 55 additions & 99 deletions public.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@
},
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Request id for distributed tracing.",
"required": false,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
}
],
"post": {
Expand Down Expand Up @@ -136,13 +130,7 @@
"summary": "Domain registration token",
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Request id",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
}
],
"post": {
Expand Down Expand Up @@ -234,27 +222,10 @@
},
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Request id for distributed tracing.",
"required": false,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
},
{
"name": "uuid",
"description": "The uuid that identify the domain.",
"required": true,
"schema": {
"$ref": "#/components/schemas/DomainId"
},
"examples": {
"a random uuid generated by 'uuid' command": {
"value": "\"2e8ce5a6-b370-11ed-9330-482ae3863d30\""
}
},
"in": "path"
"$ref": "#/components/parameters/DomainIdParam"
}
]
},
Expand All @@ -263,45 +234,16 @@
"summary": "Register domain information throw the ipa-hcc agent.",
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Request id",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
},
{
"name": "X-Rh-Idm-Registration-Token",
"description": "One-time password to authenticate domain registration with ipa-hcc command.",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhIdmRegistrationTokenHeader"
},
{
"name": "uuid",
"description": "uuid for the IPA domain.",
"required": true,
"schema": {
"$ref": "#/components/schemas/DomainId"
},
"examples": {
"uuid": {
"value": "08363cd4-bea8-11ed-b83f-482ae3863d30"
}
},
"in": "path"
"$ref": "#/components/parameters/XRhIdmVersionHeader"
},
{
"name": "X-Rh-Idm-Version",
"description": "ipa-hcc agent version",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/DomainIdParam"
}
],
"put": {
Expand Down Expand Up @@ -348,36 +290,13 @@
"summary": "Update domain information throw the ipa-hcc agent.",
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Request id",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
},
{
"name": "uuid",
"description": "uuid for the IPA domain.",
"required": true,
"schema": {
"$ref": "#/components/schemas/DomainId"
},
"examples": {
"uuid": {
"value": "08363cd4-bea8-11ed-b83f-482ae3863d30"
}
},
"in": "path"
"$ref": "#/components/parameters/XRhIdmVersionHeader"
},
{
"name": "X-Rh-Idm-Version",
"description": "ipa-hcc agent version",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/DomainIdParam"
}
],
"put": {
Expand Down Expand Up @@ -424,13 +343,7 @@
"summary": "Autoenroll host vm endpoint.",
"parameters": [
{
"name": "X-Rh-Insights-Request-Id",
"description": "Unique request id for distributing tracing.",
"required": false,
"schema": {
"type": "string"
},
"in": "header"
"$ref": "#/components/parameters/XRhInsightsRequestIdHeader"
},
{
"name": "inventory_id",
Expand Down Expand Up @@ -491,6 +404,49 @@
}
},
"components": {
"parameters": {
"DomainIdParam": {
"name": "uuid",
"description": "The uuid that identify the domain.",
"required": true,
"schema": {
"$ref": "#/components/schemas/DomainId"
},
"examples": {
"a random uuid generated by 'uuid' command": {
"value": "\"2e8ce5a6-b370-11ed-9330-482ae3863d30\""
}
},
"in": "path"
},
"XRhIdmRegistrationTokenHeader": {
"name": "X-Rh-Idm-Registration-Token",
"description": "One-time password to authenticate domain registration with ipa-hcc command.",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
},
"XRhIdmVersionHeader": {
"name": "X-Rh-Idm-Version",
"description": "ipa-hcc agent version",
"required": true,
"schema": {
"type": "string"
},
"in": "header"
},
"XRhInsightsRequestIdHeader": {
"name": "X-Rh-Insights-Request-Id",
"description": "Request id for distributed tracing.",
"required": false,
"schema": {
"type": "string"
},
"in": "header"
}
},
"responses": {
"CreateDomainResponse": {
"description": "Response when a domain has been created.",
Expand Down
125 changes: 44 additions & 81 deletions public.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ paths:
tags:
- resources
parameters:
- name: X-Rh-Insights-Request-Id
description: Request id for distributed tracing.
required: false
schema:
type: string
in: header
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
post:
description: Create a domain in the current organization.
summary: Create a domain.
Expand All @@ -89,12 +84,7 @@ paths:
description: Request a domain registration token
summary: Domain registration token
parameters:
- name: X-Rh-Insights-Request-Id
description: Request id
required: true
schema:
type: string
in: header
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
post:
description: Request a domain registration token
summary: Domain registration token request
Expand Down Expand Up @@ -151,52 +141,16 @@ paths:
tags:
- resources
parameters:
- name: X-Rh-Insights-Request-Id
description: Request id for distributed tracing.
required: false
schema:
type: string
in: header
- name: uuid
description: The uuid that identify the domain.
required: true
schema:
$ref: '#/components/schemas/DomainId'
examples:
a random uuid generated by 'uuid' command:
value: '"2e8ce5a6-b370-11ed-9330-482ae3863d30"'
in: path
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
- $ref: '#/components/parameters/DomainIdParam'
/domains/{uuid}/register:
description: First registration to update the IPA domain information.
summary: Register domain information throw the ipa-hcc agent.
parameters:
- name: X-Rh-Insights-Request-Id
description: Request id
required: true
schema:
type: string
in: header
- name: X-Rh-Idm-Registration-Token
description: One-time password to authenticate domain registration with ipa-hcc command.
required: true
schema:
type: string
in: header
- name: uuid
description: uuid for the IPA domain.
required: true
schema:
$ref: '#/components/schemas/DomainId'
examples:
uuid:
value: 08363cd4-bea8-11ed-b83f-482ae3863d30
in: path
- name: X-Rh-Idm-Version
description: ipa-hcc agent version
required: true
schema:
type: string
in: header
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
- $ref: '#/components/parameters/XRhIdmRegistrationTokenHeader'
- $ref: '#/components/parameters/XRhIdmVersionHeader'
- $ref: '#/components/parameters/DomainIdParam'
put:
description: |-
Use the one time use token to update the initial information for
Expand Down Expand Up @@ -227,27 +181,9 @@ paths:
description: Update the rhel-idm domain information.
summary: Update domain information throw the ipa-hcc agent.
parameters:
- name: X-Rh-Insights-Request-Id
description: Request id
required: true
schema:
type: string
in: header
- name: uuid
description: uuid for the IPA domain.
required: true
schema:
$ref: '#/components/schemas/DomainId'
examples:
uuid:
value: 08363cd4-bea8-11ed-b83f-482ae3863d30
in: path
- name: X-Rh-Idm-Version
description: ipa-hcc agent version
required: true
schema:
type: string
in: header
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
- $ref: '#/components/parameters/XRhIdmVersionHeader'
- $ref: '#/components/parameters/DomainIdParam'
put:
description: Update the initial information for a rhel-idm domain.
summary: Update a previously registered domain.
Expand Down Expand Up @@ -276,12 +212,7 @@ paths:
description: Endpoint used by host vm for auto-enrollment.
summary: Autoenroll host vm endpoint.
parameters:
- name: X-Rh-Insights-Request-Id
description: Unique request id for distributing tracing.
required: false
schema:
type: string
in: header
- $ref: '#/components/parameters/XRhInsightsRequestIdHeader'
- name: inventory_id
description: A Host-Based Inventory ID of the host.
required: true
Expand Down Expand Up @@ -318,6 +249,38 @@ paths:
tags:
- actions
components:
parameters:
DomainIdParam:
name: uuid
description: The uuid that identify the domain.
required: true
schema:
$ref: '#/components/schemas/DomainId'
examples:
a random uuid generated by 'uuid' command:
value: '"2e8ce5a6-b370-11ed-9330-482ae3863d30"'
in: path
XRhIdmRegistrationTokenHeader:
name: X-Rh-Idm-Registration-Token
description: One-time password to authenticate domain registration with ipa-hcc command.
required: true
schema:
type: string
in: header
XRhIdmVersionHeader:
name: X-Rh-Idm-Version
description: ipa-hcc agent version
required: true
schema:
type: string
in: header
XRhInsightsRequestIdHeader:
name: X-Rh-Insights-Request-Id
description: Request id for distributed tracing.
required: false
schema:
type: string
in: header
responses:
CreateDomainResponse:
description: Response when a domain has been created.
Expand Down

0 comments on commit 1a5760d

Please sign in to comment.