Skip to content

Can't make types readonly via NodeJS API #425

Closed
@craigmiller160

Description

@craigmiller160
const { generateApi } = require('swagger-typescript-api');
const path = require('path');
generateApi({
	name: 'my-app',
	output: path.join(process.cwd(), 'src', 'types', 'generated'),
	url: 'https://127.0.0.1:8080/v3/api-docs',
	prettier: true,
	generateClient: false,
	sortTypes: true
})
	.then(() => console.log('API types successfully generated'))
	.catch((ex) => console.error('Error generating API types', ex));

This all works just fine, except it outputs non-read-only types. From the docs I've seen, the only way to get readonly types is via the CLI. This seems like a strange limitation of the NodeJS API. Is there something I'm missing? Or is there just no way to make the generated types readonly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions