feat(parser): rewriting the library in typescript#932
Conversation
Co-authored-by: JonLuca De Caro <hello@jonlu.ca>
… and running again
kanadgupta
left a comment
There was a problem hiding this comment.
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.
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.
This script is an internal-only thing for refreshing a unit test dataset. Definitely open to dropping Node 18 support.
| import fs from 'node:fs'; | ||
|
|
||
| import openapiParser from '@readme/openapi-parser'; | ||
| import { OpenAPIParser } from '@readme/openapi-parser'; |
There was a problem hiding this comment.
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.
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`. |
🐳 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. ↩