Skip to content

Generate a separate interface for each omponents.schemas model #1414

Closed
@alex-aveva

Description

@alex-aveva

Description

Generate a separate interface for each components.schemas model to provide a better development experience and easier models consumption.

Proposal

I've created a diff PR with the proposed changes, showing how the final result would look. As you can see, it's a fairly straightforward change, but it can make a significant difference in how VSCode provides hints. You can compare the before and after screenshots below.

Before:
image

After
image
image

In real-world environments, having anonymous classes & hints is not very useful. Models often tend to be large, and in the many of cases, it's not even possible to determine which model you're looking at just by examining its shape. Providing a model interface name addresses this issue. It also enables referencing models by their interface names throughout the codebase, which is very convenient,

This perhaps can be an optional generator switch.

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRs welcomePRs are welcome to solve this issue!enhancementNew feature or requestopenapi-tsRelevant to the openapi-typescript librarystaletrickyComplex problem which requires deep knowledge of TS, OpenAPI, this project, or all three

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions