Skip to content

Commit

Permalink
Merge pull request #1 from maxholman/oai31
Browse files Browse the repository at this point in the history
OpenAPI 3.1 output
  • Loading branch information
maxholman authored Oct 13, 2024
2 parents 7e2cf0f + 29f9266 commit 1860fc7
Show file tree
Hide file tree
Showing 35 changed files with 8,062 additions and 5,847 deletions.
26 changes: 24 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: ['@block65/eslint-config', '@block65/eslint-config/javascript'],
extends: [
'@block65/eslint-config/javascript',
'@block65/eslint-config/typescript',
],
parserOptions: {
project: true,
project: ['./tsconfig.json'],
},

overrides: [
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/test/*.ts'],
rules: {
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/consistent-type-imports': 'off',
'import/no-extraneous-dependencies': 'off',
},
},

{
files: ['*.config.js', '*.config.ts', '*.workspace.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
};
14 changes: 8 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
node-version-file: .node-version

- run: make

- run: pnpm publish --access=public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
13 changes: 7 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
node-version-file: .node-version

- run: make test
23 changes: 10 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ SRCS = $(wildcard lib/**)

all: dist

.PHONY: deps
deps: node_modules

.PHONY: clean
clean:
pnpm tsc -b --clean
clean: node_modules
pnpm exec tsc -b --clean

.PHONY: test
test:
pnpm tsc
NODE_OPTIONS=--experimental-vm-modules pnpm jest
test: node_modules
pnpm exec tsc
pnpm exec vitest

node_modules: package.json
pnpm install

dist: node_modules tsconfig.json $(SRCS)
pnpm tsc
pnpm exec tsc

.PHONY: dist-watch
dist-watch:
pnpm tsc -w --preserveWatchOutput
dist-watch: node_modules
pnpm exec tsc -w --preserveWatchOutput

.PHONY: pretty
pretty: node_modules
pnpm eslint --fix .
pnpm prettier --write .
pnpm exec eslint --fix . || true
pnpm exec prettier --write .
72 changes: 72 additions & 0 deletions __tests__/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Synth > JSON Schema snapshot 1`] = `
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"Address": {
"additionalProperties": false,
"properties": {
"postcode": {
"format": "int32",
"maximum": 9999,
"minimum": 1000,
"type": "integer",
},
},
"required": [
"name",
],
"type": "object",
},
"Id": {
"type": "string",
},
"UpdateUserRequest": {
"additionalProperties": false,
"minProperties": 1,
"properties": {
"address": {
"$ref": "#/components/schemas/Address",
},
"age": {
"format": "int32",
"minimum": 0,
"type": "integer",
},
},
"type": "object",
},
"User": {
"additionalProperties": false,
"properties": {
"address": {
"$ref": "#/components/schemas/Address",
},
"age": {
"format": "int32",
"minimum": 0,
"type": "integer",
},
"name": {
"type": "string",
},
"userId": {
"$ref": "#/components/schemas/Id",
},
},
"required": [
"name",
],
"type": "object",
},
"Users": {
"items": {
"$ref": "#/components/schemas/User",
},
"type": "array",
"uniqueItems": true,
},
},
}
`;
Loading

0 comments on commit 1860fc7

Please sign in to comment.