Package Exports
- @buildwithlayer/openapi-zod-spec/3/0/0/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/0/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/0/open-api.js
- @buildwithlayer/openapi-zod-spec/3/0/0/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/0/0/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/0/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/0/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/0/0/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/0/1/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/1/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/1/open-api.js
- @buildwithlayer/openapi-zod-spec/3/0/1/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/0/1/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/1/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/1/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/0/1/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/0/2/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/2/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/2/open-api.js
- @buildwithlayer/openapi-zod-spec/3/0/2/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/0/2/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/2/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/2/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/0/2/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/0/3/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/3/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/3/open-api.js
- @buildwithlayer/openapi-zod-spec/3/0/3/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/0/3/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/3/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/3/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/0/3/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/callback.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/callback.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/callback.js
- @buildwithlayer/openapi-zod-spec/3/0/4/callback.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/components.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/components.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/components.js
- @buildwithlayer/openapi-zod-spec/3/0/4/components.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/encoding.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/encoding.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/encoding.js
- @buildwithlayer/openapi-zod-spec/3/0/4/encoding.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/header.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/header.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/header.js
- @buildwithlayer/openapi-zod-spec/3/0/4/header.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/info.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/info.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/info.js
- @buildwithlayer/openapi-zod-spec/3/0/4/info.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/license.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/license.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/license.js
- @buildwithlayer/openapi-zod-spec/3/0/4/license.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/link.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/link.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/link.js
- @buildwithlayer/openapi-zod-spec/3/0/4/link.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/media-type.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/media-type.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/media-type.js
- @buildwithlayer/openapi-zod-spec/3/0/4/media-type.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/open-api.js
- @buildwithlayer/openapi-zod-spec/3/0/4/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/operation.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/operation.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/operation.js
- @buildwithlayer/openapi-zod-spec/3/0/4/operation.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/parameter.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/parameter.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/parameter.js
- @buildwithlayer/openapi-zod-spec/3/0/4/parameter.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/path-item.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/path-item.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/path-item.js
- @buildwithlayer/openapi-zod-spec/3/0/4/path-item.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/paths.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/paths.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/paths.js
- @buildwithlayer/openapi-zod-spec/3/0/4/paths.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/reference.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/reference.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/reference.js
- @buildwithlayer/openapi-zod-spec/3/0/4/reference.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/request-body.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/request-body.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/request-body.js
- @buildwithlayer/openapi-zod-spec/3/0/4/request-body.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/response.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/response.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/response.js
- @buildwithlayer/openapi-zod-spec/3/0/4/response.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/responses.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/responses.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/responses.js
- @buildwithlayer/openapi-zod-spec/3/0/4/responses.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/schema.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/schema.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/schema.js
- @buildwithlayer/openapi-zod-spec/3/0/4/schema.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/security-scheme.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/security-scheme.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/security-scheme.js
- @buildwithlayer/openapi-zod-spec/3/0/4/security-scheme.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/server-variable.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/server-variable.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/server-variable.js
- @buildwithlayer/openapi-zod-spec/3/0/4/server-variable.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/server.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/server.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/server.js
- @buildwithlayer/openapi-zod-spec/3/0/4/server.js.map
- @buildwithlayer/openapi-zod-spec/3/0/4/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/0/4/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/0/4/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/0/4/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/callback.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/callback.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/callback.js
- @buildwithlayer/openapi-zod-spec/3/1/0/callback.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/components.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/components.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/components.js
- @buildwithlayer/openapi-zod-spec/3/1/0/components.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/open-api.js
- @buildwithlayer/openapi-zod-spec/3/1/0/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/operation.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/operation.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/operation.js
- @buildwithlayer/openapi-zod-spec/3/1/0/operation.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/path-item.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/path-item.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/path-item.js
- @buildwithlayer/openapi-zod-spec/3/1/0/path-item.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/paths.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/paths.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/paths.js
- @buildwithlayer/openapi-zod-spec/3/1/0/paths.js.map
- @buildwithlayer/openapi-zod-spec/3/1/0/upgrade.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/0/upgrade.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/0/upgrade.js
- @buildwithlayer/openapi-zod-spec/3/1/0/upgrade.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/callback.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/callback.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/callback.js
- @buildwithlayer/openapi-zod-spec/3/1/1/callback.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/components.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/components.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/components.js
- @buildwithlayer/openapi-zod-spec/3/1/1/components.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/contact.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/contact.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/contact.js
- @buildwithlayer/openapi-zod-spec/3/1/1/contact.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/discriminator.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/discriminator.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/discriminator.js
- @buildwithlayer/openapi-zod-spec/3/1/1/discriminator.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/encoding.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/encoding.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/encoding.js
- @buildwithlayer/openapi-zod-spec/3/1/1/encoding.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/example.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/example.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/example.js
- @buildwithlayer/openapi-zod-spec/3/1/1/example.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/external-documentation.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/external-documentation.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/external-documentation.js
- @buildwithlayer/openapi-zod-spec/3/1/1/external-documentation.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/header.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/header.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/header.js
- @buildwithlayer/openapi-zod-spec/3/1/1/header.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/info.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/info.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/info.js
- @buildwithlayer/openapi-zod-spec/3/1/1/info.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/license.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/license.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/license.js
- @buildwithlayer/openapi-zod-spec/3/1/1/license.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/link.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/link.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/link.js
- @buildwithlayer/openapi-zod-spec/3/1/1/link.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/media-type.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/media-type.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/media-type.js
- @buildwithlayer/openapi-zod-spec/3/1/1/media-type.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flow.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flow.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flow.js
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flow.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flows.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flows.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flows.js
- @buildwithlayer/openapi-zod-spec/3/1/1/oauth-flows.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/open-api.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/open-api.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/open-api.js
- @buildwithlayer/openapi-zod-spec/3/1/1/open-api.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/operation.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/operation.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/operation.js
- @buildwithlayer/openapi-zod-spec/3/1/1/operation.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/parameter.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/parameter.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/parameter.js
- @buildwithlayer/openapi-zod-spec/3/1/1/parameter.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/path-item.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/path-item.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/path-item.js
- @buildwithlayer/openapi-zod-spec/3/1/1/path-item.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/paths.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/paths.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/paths.js
- @buildwithlayer/openapi-zod-spec/3/1/1/paths.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/reference.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/reference.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/reference.js
- @buildwithlayer/openapi-zod-spec/3/1/1/reference.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/request-body.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/request-body.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/request-body.js
- @buildwithlayer/openapi-zod-spec/3/1/1/request-body.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/response.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/response.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/response.js
- @buildwithlayer/openapi-zod-spec/3/1/1/response.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/responses.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/responses.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/responses.js
- @buildwithlayer/openapi-zod-spec/3/1/1/responses.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/schema.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/schema.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/schema.js
- @buildwithlayer/openapi-zod-spec/3/1/1/schema.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/security-requirement.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/security-requirement.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/security-requirement.js
- @buildwithlayer/openapi-zod-spec/3/1/1/security-requirement.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/security-scheme.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/security-scheme.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/security-scheme.js
- @buildwithlayer/openapi-zod-spec/3/1/1/security-scheme.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/server-variable.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/server-variable.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/server-variable.js
- @buildwithlayer/openapi-zod-spec/3/1/1/server-variable.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/server.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/server.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/server.js
- @buildwithlayer/openapi-zod-spec/3/1/1/server.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/tag.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/tag.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/tag.js
- @buildwithlayer/openapi-zod-spec/3/1/1/tag.js.map
- @buildwithlayer/openapi-zod-spec/3/1/1/xml.d.ts
- @buildwithlayer/openapi-zod-spec/3/1/1/xml.d.ts.map
- @buildwithlayer/openapi-zod-spec/3/1/1/xml.js
- @buildwithlayer/openapi-zod-spec/3/1/1/xml.js.map
- @buildwithlayer/openapi-zod-spec/index.d.ts
- @buildwithlayer/openapi-zod-spec/index.d.ts.map
- @buildwithlayer/openapi-zod-spec/index.js
- @buildwithlayer/openapi-zod-spec/index.js.map
- @buildwithlayer/openapi-zod-spec/package.json
- @buildwithlayer/openapi-zod-spec/utils.d.ts
- @buildwithlayer/openapi-zod-spec/utils.d.ts.map
- @buildwithlayer/openapi-zod-spec/utils.js
- @buildwithlayer/openapi-zod-spec/utils.js.map
Readme
OpenAPI Zod Spec
This is a simple Zod Schema for Open API specs version 3.X.X.
Prerequisites
This project requires NodeJS (version 18 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
10.2.4
v20.11.0Table of contents
Installation
BEFORE YOU INSTALL: please read the prerequisites
To install and set up the library, run:
$ npm install @buildwithlayer/openapi-zod-specOr if you prefer using Yarn:
$ yarn add @buildwithlayer/openapi-zod-specUsage
Loading an OpenAPI Spec
From JSON:
import {OpenAPISpec} from '@buildwithlayer/openapi-zod-spec/index.js';
import {rawSpec} from './openapi.json';
const spec = OpenAPISpec.parse(rawSpec);From YAML:
import {OpenAPISpec} from '@buildwithlayer/openapi-zod-spec/index.js';
import fs from 'fs';
import yaml from 'js-yaml';
const pathToYamlFile = './path/to/openapi.yml';
const fileContents = fs.readFileSync(pathToYamlFile, 'utf-8');
const rawSpec = yaml.load(fileContents);
const spec = OpenAPISpec.parse(rawSpec);Upgrading an OpenAPI Spec
import {OpenAPISpec, upgrade} from '@buildwithlayer/openapi-zod-spec/index.js';
import {oldSpec} from './openapi.json';
const upgradedSpec = upgrade(OpenAPISpec.parse(oldSpec));Contributing
These instructions will be updated soon.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests to us.
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Add your changes: git add .
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request 😎
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
MIT License © Andrea SonnY