-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat(parser): rewriting the library in typescript #932
Conversation
Co-authored-by: JonLuca De Caro <[email protected]>
… and running again
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.
pushed up a couple smol changes to get tests passing again. i'm nervous about some of the uglier parts that we're now fully responsible for (e.g., the wild instance.method.apply
stuff, the use of @jsdevtools/ono
, etc.) but overall content with this
const fs = require('fs'); | ||
import fs from 'node:fs'; | ||
|
||
const __dirname = import.meta.dirname; |
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.
just a flag — import.meta.dirname
only became available in node 20: https://nodejs.org/api/esm.html#importmetadirname
wouldn't be opposed to dropping support for node 18 since it EOLs in a couple months!
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 script is an internal-only thing for refreshing a unit test dataset. Definitely open to dropping Node 18 support.
import type { OpenAPI, OpenAPIV2, OpenAPIV3 } from 'openapi-types'; | ||
|
||
import fs from 'node:fs'; | ||
|
||
import openapiParser from '@readme/openapi-parser'; | ||
import { OpenAPIParser } from '@readme/openapi-parser'; |
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.
considering this is now a named import:
- i'm increasingly of the belief that we should make this a breaking change (and we consider dropping node 18 support in the process)
- we should make sure the README for this package is updated accordingly
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.
was already planning on making all of this a breaking change once the warning work is in
planning on doing a docs only followup after merging this
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
// DOM is needed because `@apidevtools/json-schema-ref-parser` uses `window` and `location`. |
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.
thanks i hate it
🐳 Context
Now that our fork of @apidevtools/swagger-parser has fully deviated and was moved here from our other repository I have built off of JonLuca's1 starting work over in APIDevTools/swagger-parser#253 and rewritten the library in TS.
This is all going to be the basis for a slew of forthcoming changes in order to support error levels.
Because this is a full rewrite, and a lot of things have changed, this will incur a major version bump.
🧰 Changes
Footnotes
Because I adapted heavily from his draft PR of this rewrite over in the swagger-parser repository I've credited him as a co-author of this work. ↩