Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding contentEncoding and contentMediaType to 3.1 #126

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/model/openapi31.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ export interface SchemaObject extends ISpecificationExtension {
required?: string[];
enum?: any[];
prefixItems?: (SchemaObject | ReferenceObject)[];
/**
* @desc JSON Schema compliant Content-Type, optional when specified as a key of ContentObject
* @example image/png
*/
contentMediaType?: string;
/**
* @desc Specifies the Content-Encoding for the schema, supports all encodings from RFC4648, and "quoted-printable" from RFC2045
* @override format
* @see https://datatracker.ietf.org/doc/html/rfc4648
* @see https://datatracker.ietf.org/doc/html/rfc2045#section-6.7
* @example base64
*/
contentEncoding?: string;
}

/**
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions test/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import assert from 'node:assert';
import { oas31 } from 'openapi3-ts';
import { OpenApiBuilder } from 'openapi3-ts/oas31';

const builder1 = new oas31.OpenApiBuilder();
assert.ok(typeof builder1.rootDoc === 'object');
const builder2 = new OpenApiBuilder();
assert.ok(typeof builder2.rootDoc === 'object');
14 changes: 8 additions & 6 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"scripts": {
"test:cjs": "node index.cjs",
"test:mjs": "node index.mjs",
"test:ts": "ts-node --project fixture/tsconfig.node.json index.ts",
"test:ts-esm": "ts-node --esm --project fixture/tsconfig.node.json index.ts",
"test:ts-node16": "ts-node --project fixture/tsconfig.node16.json index.ts",
"test:ts-esm-node16": "ts-node --esm --project fixture/tsconfig.node16.json index.ts"
"test:ts": "tsx --tsconfig fixture/tsconfig.node.json index.cts",
"test:ts-esm": "tsx --tsconfig fixture/tsconfig.node.json index.mts",
"test:ts-node16": "tsx --tsconfig fixture/tsconfig.node16.json index.cts",
"test:ts-esm-node16": "tsx --tsconfig fixture/tsconfig.node16.json index.mts"
},
"dependencies": {
"openapi3-ts": "file:..",
"ts-node": "^10.9.1"
"openapi3-ts": "file:.."
},
"devDependencies": {
"tsx": "^4.6.2"
}
}