MCPcopy
hub / github.com/GitbookIO/gitbook / parameterToProperty

Function parameterToProperty

packages/react-openapi/src/utils.ts:104–123  ·  view source on GitHub ↗
(
    parameter: OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject | OpenAPIV3_1.ReferenceObject
)

Source from the content-addressed store, hash-verified

102 * Transform a parameter object to a property object.
103 */
104export function parameterToProperty(
105 parameter: OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject | OpenAPIV3_1.ReferenceObject
106): {
107 propertyName: string | undefined;
108 schema: OpenAPIV3.SchemaObject;
109 required: boolean | undefined;
110} {
111 if (checkIsReference(parameter)) {
112 return {
113 propertyName: parameter.$ref ?? 'Unknown ref',
114 schema: {},
115 required: undefined,
116 };
117 }
118 return {
119 propertyName: parameter.name,
120 schema: resolveParameterSchema(parameter),
121 required: parameter.required,
122 };
123}
124
125/**
126 * Format the example of a schema.

Callers 1

OpenAPIResponseFunction · 0.90

Calls 2

checkIsReferenceFunction · 0.85
resolveParameterSchemaFunction · 0.85

Tested by

no test coverage detected