1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/openapi/spec/client-features-query-schema.ts
Thomas Heartman 6afc0a6954
fix: fix broken OpenAPI spec (#1846)
* Wip: fix openapi spec

* Feat: add openapi enforcer for enforcing the generated schema

* Chore: Allow the example keyword in params

* Feat: add validator tests and fix some errors

* Use @apidevtools/swagger-parser for schema validation

* Wip: refactor tests for updated schema name

* Feat: update request params creation method

* Feat: add query params to state

* Refactor: move mapping test into separate function

* Refactor: rename request-parameters -> query-parameters

* Refactor: expose only finished query parameters

* Wip: fixup param types

* Refactor: remove unused types

* Chore: rename and cleanup

* Chore: cleanup

* Fix: Update snapshot

* Fix: use ?? Instead of paramToBool to get defaults

* Wip: generate query param object type from openapi params list

* Wip: use generated types for export query params

* Revert "Fix: use ?? Instead of paramToBool to get defaults"

This reverts commit 842567500b.

Because we accept bools, strings, and numbers, this is the only way to
do it.

* Chore: update and pin json-schema-to-ts

* Fix: use `&` to merge types

* Update snapshot

* Chore: rename export-parameters-schema -> export-query-parameters

When it ends in `schema`, the tests expect it to be included in the
openapi index file.
2022-07-28 09:19:58 +02:00

39 lines
878 B
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const clientFeaturesQuerySchema = {
$id: '#/components/schemas/clientFeaturesQuerySchema',
type: 'object',
additionalProperties: false,
properties: {
tag: {
type: 'array',
items: {
type: 'array',
items: {
type: 'string',
},
},
},
project: {
type: 'array',
items: {
type: 'string',
},
},
namePrefix: {
type: 'string',
},
environment: {
type: 'string',
},
inlineSegmentConstraints: {
type: 'boolean',
},
},
components: {},
} as const;
export type ClientFeaturesQuerySchema = FromSchema<
typeof clientFeaturesQuerySchema
>;