api
Version:
Magical SDK generation from an OpenAPI definition 🪄
15 lines (14 loc) • 660 B
TypeScript
import type { SchemaWrapper } from 'oas/dist/operation/get-parameters-as-json-schema';
/**
* Run through a JSON Schema object and compose up an object containing default data for any schema
* property that is required and also has a defined default.
*
* Code partially adapted from the `json-schema-default` package but modified to only return
* defaults of required properties.
*
* @todo This is a good candidate to be moved into a core `oas` library method.
* @see {@link https://github.com/mdornseif/json-schema-default}
*/
export default function getJSONSchemaDefaults(jsonSchemas: SchemaWrapper[]): {
[x: string]: Record<string, unknown>;
};