-
-
Notifications
You must be signed in to change notification settings - Fork 27
changed the required files for openApi 3.2 - #82 #86
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to work on this today, but I'm happy to have you contribute instead.
There's a little more to this one than adding an export and updating the README. There are two things missing: update the schema (schema.js) and update the OpenApi type (index.d.ts).
The schema can be found at https://spec.openapis.org/oas/3.2/schema/2025-09-17.html.
For the OpenApi type, start by copying the type from openapi-3-2 and make whatever changes are needed to make it support 3.2. The best way is probably to compare what changed from the 3.1 schema to the 3.2 and make changes accordingly.
package.json
Outdated
| "typescript-eslint": "*", | ||
| "undici": "*", | ||
| "vitest": "*", | ||
| "vitest": "^3.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back.
README.md
Outdated
| <!-- ## `package.json` Exports --> | ||
| <!-- ```json | ||
| "exports": { | ||
| "./openapi-3-0": "./openapi-3-0/index.js", | ||
| "./openapi-3-1": "./openapi-3-1/index.js", | ||
| "./openapi-3-2": "./openapi-3-2/index.js" | ||
| } --> | ||
|
|
||
| **`package.json` exports** — add: | ||
|
|
||
| ```json | ||
| "./openapi-3-2": "./openapi-3-2/index.js" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? Looks like AI slop.
The schema.js, index.d.ts and other files of OpenApi (openApi-3-2) has been revised accordingly to the requirements has been addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate that you found a couple typos! Thanks! But, much of this still looks like AI slop, especially the OpenAPI32 type. It's incomplete and references types that don't exist. Start by making a copy of the 3.1 version and make changes from there.
I suggest you turn off the AI and use your own intelligence for this one. It's hurting more than helping. One of the things you did was to change several schemas to be the same (wrong) schema. If you were using your own intellegence, you would have realized that it doesn't make any sense to have six copies of the same schema and there's a reason for the differences.
| it(test.description, () => { | ||
| const output = _validate(test.data); | ||
| expect(output.valid).to.equal(test.valid); | ||
| expect(output.valid).toBe(test.valid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back. Avoid unnecessary changes.
openapi-3-2/meta/base.js
Outdated
| "type": "string" | ||
| }, | ||
| "mapping": { | ||
| "mappings": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. Change it back.
| wrapped?: boolean; | ||
| }; | ||
|
|
||
| // TODO: Fill in this type when 3.2 is published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can be removed since we're filling in the type now.
| it(test.description, () => { | ||
| const output = _validate(test.data); | ||
| expect(output.valid).to.equal(test.valid); | ||
| expect(output.valid).toBe(test.valid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back.
openapi-3-2/schema-base.js
Outdated
|
|
||
| "$defs": { | ||
| "dialect": { "const": "https://spec.openapis.org/oas/3.2/dialect/base" }, | ||
| "dialect": { "const": "https://json-schema.org/draft/2020-12/schema" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back. schema-base uses the OpenAPI JSON Schema dialect. Change the description back as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you did the same thing with the rest of the schema-draft-x schemas. Change them all back. They were correct as they were.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back.
schema-baseuses the OpenAPI JSON Schema dialect. Change the description back as well.
is it like we have to use OpenAPI json Schema dialect for the cases when there might be chances of breakout in code ? but "https://spec.openapis.org/oas/3.2/dialect/base" this link is not working and showing 404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAPI allows you to use any dialect of JSON Schema you like, but it defaults to using the OpenAPI version of JSON Schema whose identifier is https://spec.openapis.org/oas/3.2/dialect/base. Keep in mind that JSON Schema identifiers aren't necessarily hosted on the web. It just needs to be loaded into the validator.
So, schema-base is the schema for OpenAPI with the default JSON Schema dialect. Then I also include schema-draft-x for each of the JSON Schema dialects this package supports. For example, schema-draft-07 is the schema for OpenAPI with the JSON Schema draft-07 dialect.
Hope that makes it more clear. I'm happy to answer any questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually default latest dialect $id for 3.2 is https://spec.openapis.org/oas/3.2/dialect/2025-09-17 (which is also a valid resolvable url)
As described here: https://spec.openapis.org/oas/3.2/schema-base/2025-09-17.html
They changed to date based versioning for dialect schema as of version 2024‑11‑14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to only include the latest version in this package and to maintain the dateless URI as an alias for the latest version. If users feel like they need a specific version, they can load those schemas themselves.
Thank you for your guidance. I have removed the unwanted changes and reverted to previous structure, can you review the updated version and let me know if anything needs to be done regarding this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking better, but you still haven't fixed the OpenApi type. Have a close look. Notice that you reference many types that you don't define: Server, SecurityRequirements, Response, Callback, and more.
I'm pushing changes to your branch where I copy the 3.1 type to 3.2 like I suggested you do twice already. Your next step is to make the necessary changes to update the 3.2 copy to reflect the changes from 3.1 -> 3.2.
|
@mdrafi28 Sorry, git did something unexpected when I tried to push a commit to help show you what I'm looking for. It ended up removing your commits and closing the PR. That was not my intention, but I can't seem to undo it. Try pushing your commits again and creating a new PR. But, this time do it from a branch. Don't use |
@jdesrosiers can u check n tell if there are any other changes to be made |
Resolves #82
This PR addresses the documentation and script references for OpenAPI 3.2 support. While OpenAPI 3.2 functionality was already working, it was not properly documented.
Changes made:
With these updates, users and contributors can now easily identify OpenAPI 3.2 support, and the project continues to function without any issues.