From de271b09eeee9d054704f9c0afe00b7d8a59b0fb Mon Sep 17 00:00:00 2001 From: Jakub Jankowski Date: Mon, 15 Feb 2021 20:45:45 +0100 Subject: [PATCH] feat: extend annotations --- src/accessors/getAnnotations.ts | 2 +- src/nodes/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accessors/getAnnotations.ts b/src/accessors/getAnnotations.ts index 9ef9cba..5d8649c 100644 --- a/src/accessors/getAnnotations.ts +++ b/src/accessors/getAnnotations.ts @@ -2,7 +2,7 @@ import type { SchemaAnnotations } from '../nodes/types'; import type { SchemaFragment } from '../types'; import { pick } from '../utils/pick'; -const ANNOTATIONS: SchemaAnnotations[] = ['description', 'default', 'examples']; +const ANNOTATIONS: SchemaAnnotations[] = ['description', 'default', 'examples', 'const', 'x-example']; export function getAnnotations(fragment: SchemaFragment) { return pick(fragment, ANNOTATIONS); diff --git a/src/nodes/types.ts b/src/nodes/types.ts index 2a9e621..cb54961 100644 --- a/src/nodes/types.ts +++ b/src/nodes/types.ts @@ -25,6 +25,6 @@ export enum SchemaCombinerName { OneOf = 'oneOf', } -export type SchemaAnnotations = 'description' | 'default' | 'examples'; +export type SchemaAnnotations = 'description' | 'default' | 'examples' | 'const' | 'x-example'; export type SchemaMeta = 'id' | '$schema';