Skip to content

Change hsjs-scaffold to include YAML openapi file instead of creating openapi3.ts #7288

Closed as not planned
@diberry

Description

@diberry

Clear and concise description of the problem

Why build a version of the openapi3 as a JSON object when TSP can output the openapi and it can be directly included in the project by relative path as a yaml file?

If the issue is you need to control that the openapi schema is generated even if it hasn't been requested, create the openapi3.yaml file, instead of a .ts file.

From npm package for swagger-ui-express: Load swagger from yaml file.

const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const fs = require("fs")
const YAML = require('yaml')

const file  = fs.readFileSync('./swagger.yaml', 'utf8')
const swaggerDocument = YAML.parse(file)

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

@willmtemple @mario-guerra

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions