feat(types): add @oasty/types with OpenAPI 3.0-3.2 type definitions - #1
Merged
Merged
Conversation
TypeScript types for the OpenAPI Specification authored against 3.0.4, 3.1.2, and 3.2.0, one module per minor version. Later versions re-export types that are structurally unchanged (including everything they reference) from the previous module and redefine only what changed, so the spec's own evolution is visible in the type layer. Authored from the official spec documents and verified against them by field-level review; validated by compiling the official OAI example set and both schema-test pass suites (83 documents) plus a popular real-world spec, committed as a regression corpus under packages/types/tests. Built with unbuild using orpc-style dev/publish exports. The sync:sponsors script now lint-fixes whatever files changed, discovered via git instead of hardcoded paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
@oasty/typespackage: fully documented TypeScript types for the OpenAPI Specification, authored against 3.0.4, 3.1.2, and 3.2.0 — one module per minor version, exported as@oasty/types/v3.0–v3.2plus root namespaces and cross-version unions. Each version re-exports what is structurally unchanged from the previous one and redefines only what changed, so the spec's evolution (JSON Schema 2020-12 in 3.1,$self/QUERY/querystring/streaming in 3.2) is visible in the type layer itself.Design
@seelinks,@default, and@deprecatedwhere the spec says so.1XX–5XXresponse keys and/-prefixed paths are template-literal index signatures, and each version'sopenapifield is version-typed for narrowing.SchemaObject<T = unknown>types the data-carrying fields (enum,default,example, andconst/examplesin 3.1+); the default keeps plainSchemaObjectunchanged.Verification
tests/schema/passsuites from the spec repo, committed as a regression corpus underpackages/types/teststhat roottscre-checks; the popular Train Travel API also compiles clean.tests/schema/faildocuments, the type-expressible ones are rejected for the right reasons — including 3.2-only values (style: "cookie") failing in the 3.1 module.@ts-expect-errortests (nullablevstypearrays, boolean vs numeric exclusive bounds, nowebhooksin 3.0, no QUERY before 3.2).Tooling
src/*.tsin dev,dist/*.d.mts+.mjswhen published); declarations keep all JSDoc.sync:sponsorsnow lint-fixes exactly the files that changed, discovered via git rather than hardcoded paths, so future directories are covered automatically.tsconfig.lib.jsondrops the DOM libs;type:check,lint:check,test, and the package build are all green.