Skip to content

Commit

Permalink
re-enable keywords now properly supported (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
uwinkelvos authored Dec 27, 2024
1 parent 98d5e4e commit 83dac8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/framework/ajv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ function createAjv(
for (let [formatName, formatDefinition] of Object.entries(options.formats)) {
ajv.addFormat(formatName, formatDefinition);
}
ajv.removeKeyword('propertyNames');
ajv.removeKeyword('contains');
ajv.removeKeyword('const');

if (options.serDesMap) {
// Alias for `type` that can execute AFTER x-eov-res-serdes
Expand Down
5 changes: 3 additions & 2 deletions src/framework/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export interface NormalizedOpenApiValidatorOpts extends OpenApiValidatorOpts {

export namespace OpenAPIV3 {
export interface DocumentV3 {
openapi: string;
openapi: `3.0.${string}`;
info: InfoObject;
servers?: ServerObject[];
paths: PathsObject;
Expand All @@ -208,7 +208,8 @@ export namespace OpenAPIV3 {
pathItems?: { [path: string]: PathItemObject | ReferenceObject }
}

export interface DocumentV3_1 extends Omit<DocumentV3, 'paths' | 'info' | 'components'> {
export interface DocumentV3_1 extends Omit<DocumentV3, 'paths' | 'info' | 'components'| "openapi" > {
openapi: `3.1.${string}`;
paths?: DocumentV3['paths'];
info: InfoObjectV3_1;
components: ComponentsV3_1;
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares/openapi.request.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ class Security {
apiDocs: OpenAPIV3.DocumentV3 | OpenAPIV3.DocumentV3_1,
schema: OperationObject,
): string[] {
const hasPathSecurity = schema.security?.length > 0 ?? false;
const hasRootSecurity = apiDocs.security?.length > 0 ?? false;
const hasPathSecurity = schema.security ? schema.security.length > 0 : false;
const hasRootSecurity = apiDocs.security ? apiDocs.security.length > 0 : false;

let usedSecuritySchema: SecurityRequirementObject[] = [];
if (hasPathSecurity) {
Expand Down

0 comments on commit 83dac8a

Please sign in to comment.