Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat!: new @scalar/openapi-types package (#175)
Browse files Browse the repository at this point in the history
* feat: add new @scalar/openapi-types package

* docs(changeset): feat: new @scalar/openapi-types package

* chore: reset version

* chore: clean up, add type tests

* chore: mark @scalar/openapi-types as external

* test: add custom extensions
  • Loading branch information
hanspagel authored Aug 27, 2024
1 parent aec9f22 commit 5706b18
Show file tree
Hide file tree
Showing 18 changed files with 312 additions and 2,491 deletions.
6 changes: 6 additions & 0 deletions .changeset/rude-rivers-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@scalar/openapi-parser': minor
'@scalar/openapi-types': minor
---

feat: new @scalar/openapi-types package
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ Modern OpenAPI parser written in TypeScript with support for OpenAPI 3.1, OpenAP
- [ ] Amazing error output
- [ ] Support for OpenAPI 4.0 👀

## Limitations

References are hard and the following features aren’t implemented yet (but will be in the future):

- URLs

## Installation

```
```bash
npm add @scalar/openapi-parser
```

Expand Down Expand Up @@ -148,6 +142,29 @@ validate(specification, {
})
```

### TypeScript

If you just look for our types, you can install the package separately:

```bash
npm add @scalar/openapi-types
```

And use it like this:

```ts
import type { OpenAPI } from '@scalar/openapi-types'

const file: OpenAPI.Document = {
openapi: '3.1.0',
info: {
title: 'Hello World',
version: '1.0.0',
},
paths: {},
}
```

### Advanced: URL and file references

You can reference other files, too. To do that, the parser needs to know what files are available.
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Modern OpenAPI parser written in TypeScript, with support for Swagger 2.0, OpenA

## Installation

```
```bash
npm add @scalar/openapi-parser
```

Expand Down
3 changes: 2 additions & 1 deletion packages/openapi-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"rollup": "^4.19.2",
"rollup-plugin-output-size": "^1.4.1",
"rollup-plugin-webpack-stats": "^1.0.1",
"tinybench": "^2.8.0"
"tinybench": "^2.8.0",
"@scalar/openapi-types": "workspace:*"
},
"dependencies": {
"ajv": "^8.17.1",
Expand Down
Loading

0 comments on commit 5706b18

Please sign in to comment.