Skip to content

Commit

Permalink
Return example if present when generating from schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sserrata committed Oct 17, 2022
1 parent b599d06 commit 893ea0f
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,11 @@ function sampleResponseFromProp(name: string, prop: any, obj: any): any {

export const sampleResponseFromSchema = (schema: SchemaObject = {}): any => {
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let { type, example, allOf, oneOf, anyOf, properties, items } = schema;

// TODO: determine if we should always ignore the example when creating from schema
// if (example !== undefined) {
// return example;
// }
if (example !== undefined) {
return example;
}

if (allOf) {
const { mergedSchemas }: { mergedSchemas: SchemaObject } =
Expand Down

0 comments on commit 893ea0f

Please sign in to comment.