feat(oas): identify required fields in responses - admin (#3278)

## Scope

Admin routes

## What

Add OAS `required` to response schemas.

## Why

Code generator can use the `required` property of a schema to mark fields as optional or not when generating TS types.

## Test

* Run `yarn build`
* Run `yarn openapi:generate`
* Run `yarn redocly preview-docs docs/api/admin/openapi.yaml --config=docs-util/redocly/config.yaml`
* Open the documentation preview URL in a browser (http://127.0.0.1:8080)
* Expect responses to have their fields declared as `required`
This commit is contained in:
Patrick
2023-02-17 14:19:13 +00:00
committed by GitHub
parent 3e274edb9e
commit 48ad2426aa
39 changed files with 435 additions and 24 deletions
@@ -33,6 +33,8 @@ export default (app) => {
/**
* @schema AdminStoresRes
* type: object
* required:
* - store
* properties:
* store:
* $ref: "#/components/schemas/ExtendedStoreDTO"
@@ -44,6 +46,8 @@ export type AdminStoresRes = {
/**
* @schema AdminTaxProvidersList
* type: object
* required:
* - tax_providers
* properties:
* tax_providers:
* type: array
@@ -57,6 +61,8 @@ export type AdminTaxProvidersList = {
/**
* @schema AdminPaymentProvidersList
* type: object
* required:
* - payment_providers
* properties:
* payment_providers:
* type: array