Skip to content

Commit

Permalink
Reproduction files and a workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tajnymag committed Mar 3, 2024
1 parent 1ed64ff commit a76fca2
Show file tree
Hide file tree
Showing 9 changed files with 812 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/reproduce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on: [push]

jobs:
reproduce-bearer-type-error:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run generator
run: node generate-bearer-type-error.cjs
reproduce-component-separator-error:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run generator
run: node generate-component-separator-error.cjs
reproduce-root-path-error:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run generator
run: node generate-root-path-error.cjs
30 changes: 30 additions & 0 deletions bearer-type-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
openapi: 3.0.0
info:
title: Minimal OpenAPI specification to reproduce an issue
version: 1.0.0
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer

schemas:
HelloWorld:
type: object
properties:
message:
type: string
required:
- message
paths:
"/hello":
get:
security:
- bearerAuth: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HelloWorld'
23 changes: 23 additions & 0 deletions component-separator-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
openapi: 3.0.0
info:
title: Minimal OpenAPI specification to reproduce an issue
version: 1.0.0
components:
schemas:
HelloWorld:
type: object
properties:
message:
type: string
required:
- message
paths:
"/hello":
get:
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HelloWorld'
22 changes: 22 additions & 0 deletions generate-bearer-type-error.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const path = require('path');
const { openapiToTsJsonSchema, fastifyIntegrationPlugin } = require('openapi-ts-json-schema');

async function processSpec(filename) {
return openapiToTsJsonSchema({
openApiSchema: path.resolve(__dirname, filename),
definitionPathsToGenerateFrom: ['paths', 'components.schemas'],
refHandling: 'keep',
outputPath: path.resolve(__dirname, `generated-${path.basename(filename, path.extname(filename))}`),
plugins: [
fastifyIntegrationPlugin({
sharedSchemasFilter: ({ schemaId }) => schemaId.startsWith('/components/schemas'),
}),
],
});
}

async function generate() {
await processSpec('bearer-type-error.yaml');
}

generate();
22 changes: 22 additions & 0 deletions generate-component-separator-error.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const path = require('path');
const { openapiToTsJsonSchema, fastifyIntegrationPlugin } = require('openapi-ts-json-schema');

async function processSpec(filename) {
return openapiToTsJsonSchema({
openApiSchema: path.resolve(__dirname, filename),
definitionPathsToGenerateFrom: ['paths', 'components.schemas'],
refHandling: 'keep',
outputPath: path.resolve(__dirname, `generated-${path.basename(filename, path.extname(filename))}`),
plugins: [
fastifyIntegrationPlugin({
sharedSchemasFilter: ({ schemaId }) => schemaId.startsWith('/components/schemas'),
}),
],
});
}

async function generate() {
await processSpec('component-separator-error.yaml');
}

generate();
22 changes: 22 additions & 0 deletions generate-root-path-error.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const path = require('path');
const { openapiToTsJsonSchema, fastifyIntegrationPlugin } = require('openapi-ts-json-schema');

async function processSpec(filename) {
return openapiToTsJsonSchema({
openApiSchema: path.resolve(__dirname, filename),
definitionPathsToGenerateFrom: ['paths', 'components.schemas'],
refHandling: 'keep',
outputPath: path.resolve(__dirname, `generated-${path.basename(filename, path.extname(filename))}`),
plugins: [
fastifyIntegrationPlugin({
sharedSchemasFilter: ({ schemaId }) => schemaId.startsWith('/components/schemas'),
}),
],
});
}

async function generate() {
await processSpec('root-path-error.yaml');
}

generate();
Loading

0 comments on commit a76fca2

Please sign in to comment.