scalar / openapi-parser

Modern OpenAPI parser written in TypeScript
MIT License
34 stars 1 forks source link

feat!: new `@scalar/openapi-types` package #175

Closed hanspagel closed 2 weeks ago

hanspagel commented 1 month ago

We modified and extended the openapi-types package for our use case. We’re basically allowing any user input, but still maintaining the types based on the OpenAPI specification.

With this PR, we’re exposing those types as a separate, dependency-free package called @scalar/openapi-types. Even comes with basic type tests. :)

Note: This is a breaking change. Instead of importing types from @scalar/openapi-parser, users now have to import from @scalar/openapi-types.

Usage

npm add @scalar/openapi-types

And use it like this:

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

const file: OpenAPI.Document = {
  openapi: '3.1.0',
  info: {
    title: 'Hello World',
    version: '1.0.0',
  },
  paths: {},
}
changeset-bot[bot] commented 1 month ago

πŸ¦‹ Changeset detected

Latest commit: 5c955c8a73011a9377b40b2da1ff61e51a720ce4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ---------------------- | ----- | | @scalar/openapi-parser | Minor | | @scalar/openapi-types | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

relativeci[bot] commented 1 month ago

#141 Bundle Size β€” 74.91KiB (0%).

5c955c8(current) vs aec9f22 main#137(baseline)

Bundle metrics  no changes
|            |       Current
[#141](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri?utm_source=github&utm_medium=pr-report "View bundle analysis report") |      Baseline
[#137](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/137-NmnBYYjml61pjY3I6itA?utm_source=github&utm_medium=pr-report "View baseline bundle analysis report") | |:--|--:|--:| | No change  [Initial JS](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22et.entrypoint-0_et.initial-1_et.chunk-0_et.asset-0_ft.CSS-0_ft.JS-1_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View initial JS assets") | `74.91KiB` | `74.91KiB` | | No change  [Initial CSS](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22et.entrypoint-0_et.initial-1_et.chunk-0_et.asset-0_ft.CSS-1_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View initial CSS assets") | `0B` | `0B` | | No change  [Cache Invalidation](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22changed-1%22%7D "View changed assets") | `0%` | `0%` | | No change  [Chunks](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22et.entrypoint-0_et.initial-0_et.chunk-1_et.asset-0%22%7D "View chunks") | `45` | `45` | | No change  [Assets](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22changed-0%22%7D "View assets") | `45` | `45` | | No change  [Modules](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/modules?bm=%7B%22filters%22%3A%22changed-0%22%7D "View modules") | `45` | `45` | | No change  [Duplicate Modules](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/modules?bm=%7B%22filters%22%3A%22changed-0_md-1%22%7D "View duplicate modules") | `0` | `0` | | No change  [Duplicate Code](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/modules?bm=%7B%22filters%22%3A%22changed-0_md-1%22%7D "View duplicate modules") | `0%` | `0%` | | No change  [Packages](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/packages?bp=%7B%22filters%22%3A%22changed-0%22%7D "View packages") | `0` | `0` | | No change  [Duplicate Packages](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/packages?bp=%7B%22filters%22%3A%22duplicate-1%22%7D "View duplicate packages") | `0` | `0` |
Bundle size by type  no changes
|            |       Current
[#141](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri?utm_source=github&utm_medium=pr-report "View bundle analysis report") |      Baseline
[#137](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/137-NmnBYYjml61pjY3I6itA?utm_source=github&utm_medium=pr-report "View baseline bundle analysis report") | |:--|--:|--:| | No change  [JS](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/141-Sd8h0tvn93C2bhg899ri/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-1_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View JS assets") | `74.91KiB` | `74.91KiB` |

Bundle analysis report Branch feat/new-types-package Project dashboard


Generated by RelativeCI Documentation Report issue

cloudflare-pages[bot] commented 1 month ago

Deploying openapi-parser with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c955c8
Status: βœ…  Deploy successful!
Preview URL: https://c3e716fd.openapi-parser.pages.dev
Branch Preview URL: https://feat-new-types-package.openapi-parser.pages.dev

View logs

amritk commented 1 month ago

hey @hanspagel we are going to move the types into the monorepo so I'll copy them over, then there should be no breaking changes here. We can also just re-export them after for a single source of truth