Skip to content

Commit 98c6669

Browse files
mdrafi28jdesrosiers
authored andcommitted
changed the required files for openApi 3.2 - #82
1 parent dc58152 commit 98c6669

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A collection of modules for working with JSON Schemas.
77
* Schemas can reference other schemas using a different dialect
88
* Work directly with schemas on the filesystem or HTTP
99
* OpenAPI
10-
* Versions: 3.0, 3.1
10+
* Versions: 3.0, 3.1, 3.2
1111
* Validate an OpenAPI document
1212
* Validate values against a schema from an OpenAPI document
1313
* Create custom keywords, vocabularies, and dialects
@@ -132,22 +132,22 @@ system](https://github.com/hyperjump-io/browser/#uri-schemes) provided by
132132

133133
**OpenAPI**
134134

135-
The OpenAPI 3.0 and 3.1 meta-schemas are pre-loaded and the OpenAPI JSON Schema
135+
The OpenAPI 3.0 and 3.1 and 3.2 meta-schemas are pre-loaded and the OpenAPI JSON Schema
136136
dialects for each of those versions is supported. A document with a Content-Type
137137
of `application/openapi+json` (web) or a file extension of `openapi.json`
138138
(filesystem) is understood as an OpenAPI document.
139139

140140
Use the pattern `@hyperjump/json-schema/*` to import the version you need. The
141-
available versions are `openapi-3-0` for 3.0 and `openapi-3-1` for 3.1.
141+
available versions are `openapi-3-0` for 3.0, `openapi-3-1` for 3.1, and `openapi-3-2` for 3.2.
142142

143143
```javascript
144-
import { validate } from "@hyperjump/json-schema/openapi-3-1";
144+
import { validate } from "@hyperjump/json-schema/openapi-3-2";
145145

146146

147-
// Validate an OpenAPI document
148-
const output = await validate("https://spec.openapis.org/oas/3.1/schema-base", openapi);
147+
// Validate an OpenAPI 3.2 document
148+
const output = await validate("https://spec.openapis.org/oas/3.2/schema-base", openapi);
149149

150-
// Validate an instance against a schema in an OpenAPI document
150+
// Validate an instance against a schema in an OpenAPI 3.2 document
151151
const output = await validate("./example.openapi.json#/components/schemas/foo", 42);
152152
```
153153

@@ -156,6 +156,19 @@ YAML support isn't built in, but you can add it by writing a
156156
use the one at `lib/openapi.js` as an example and replace the JSON parts with
157157
YAML.
158158

159+
<!-- ## `package.json` Exports -->
160+
<!-- ```json
161+
"exports": {
162+
"./openapi-3-0": "./openapi-3-0/index.js",
163+
"./openapi-3-1": "./openapi-3-1/index.js",
164+
"./openapi-3-2": "./openapi-3-2/index.js"
165+
} -->
166+
167+
**`package.json` exports** — add:
168+
169+
```json
170+
"./openapi-3-2": "./openapi-3-2/index.js"
171+
159172
**Media types**
160173

161174
This library uses media types to determine how to parse a retrieved document. It

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"./draft-2020-12": "./draft-2020-12/index.js",
1414
"./openapi-3-0": "./openapi-3-0/index.js",
1515
"./openapi-3-1": "./openapi-3-1/index.js",
16+
"./openapi-3-2": "./openapi-3-2/index.js",
1617
"./experimental": "./lib/experimental.js",
1718
"./instance/experimental": "./lib/instance.js",
1819
"./annotations/experimental": "./annotations/index.js",
@@ -61,7 +62,7 @@
6162
"typescript": "*",
6263
"typescript-eslint": "*",
6364
"undici": "*",
64-
"vitest": "*",
65+
"vitest": "^3.2.4",
6566
"yaml": "*"
6667
},
6768
"dependencies": {

0 commit comments

Comments
 (0)