mirror of
https://github.com/LukeHagar/openapi-definition-generator.git
synced 2025-12-06 04:20:23 +00:00
fix examples and formatting
This commit is contained in:
@@ -66,7 +66,7 @@ export function convertNumber(number: number, config: Config): OpenAPIV3_1.Schem
|
||||
output = { type: 'number' };
|
||||
}
|
||||
if (config.includeExamples) {
|
||||
output.examples = [{value: number}];
|
||||
output.examples = [ number];
|
||||
}
|
||||
|
||||
return output;
|
||||
@@ -130,7 +130,7 @@ export function convertString(string: string, config: Config): OpenAPIV3_1.Schem
|
||||
} else if (regxDate.test(string)) {
|
||||
output.format = 'date';
|
||||
}
|
||||
if (config.includeExamples) output.examples = [{value:string}];
|
||||
if (config.includeExamples) output.examples = [string];
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export function convertObject(input: unknown, config: Config): OpenAPIV3_1.Schem
|
||||
return convertString(input, config);
|
||||
} else if (typeof input === 'boolean') {
|
||||
const output: OpenAPIV3_1.SchemaObject = { type: 'boolean' };
|
||||
if (config.includeExamples) output.examples = [{value: input}];
|
||||
if (config.includeExamples) output.examples = [input];
|
||||
return output;
|
||||
} else if (input === undefined) {
|
||||
throw new Error(`undefined cannot be converted to OAS`);
|
||||
|
||||
@@ -110,7 +110,9 @@
|
||||
<label class="label flex flex-col">
|
||||
<span>Status Code</span>
|
||||
<select class="select" bind:value={status}>
|
||||
<option value="default">Default - A catch-all identifier for any other status codes not defined in the map</option>
|
||||
<option value="default">
|
||||
Default - A catch-all identifier for any other status codes not defined in the map
|
||||
</option>
|
||||
{#each status_codes.sort(sortByCode) as code}
|
||||
<option value={code.code}>
|
||||
{code.code} - {code.description
|
||||
|
||||
Reference in New Issue
Block a user