Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add OpenApi spec to feature variants (#1659)
* feat: add OpenApi spec to feature variants
- Loading branch information
Christopher Kolstad
committed
Jun 3, 2022
1 parent
05b65c5
commit 7895002
Showing
6 changed files
with
242 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { OpenAPIV3 } from 'openapi-types'; | ||
|
||
export const featureVariantsResponse: OpenAPIV3.ResponseObject = { | ||
description: 'featureVariantResponse', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/components/schemas/featureVariantsSchema', | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createSchemaObject, CreateSchemaType } from '../types'; | ||
import { variantSchema } from './variant-schema'; | ||
|
||
const schema = { | ||
type: 'object', | ||
additionalProperties: false, | ||
required: ['version', 'variants'], | ||
properties: { | ||
version: { | ||
type: 'integer', | ||
}, | ||
variants: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/variantSchema', | ||
}, | ||
}, | ||
}, | ||
'components/schemas': { | ||
variantSchema, | ||
}, | ||
}; | ||
|
||
export type FeatureVariantsSchema = CreateSchemaType<typeof schema>; | ||
|
||
export const featureVariantsSchema = createSchemaObject(schema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { OpenAPIV3 } from 'openapi-types'; | ||
|
||
export const updateFeatureVariantsRequest: OpenAPIV3.RequestBodyObject = { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/variantSchema', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters