Skip to content

case confusion in the generated output.  #13

@dwjohnston

Description

@dwjohnston

I have a repro for this here: https://github.com/dwjohnston/open-api-play/tree/91bf3bd7e1c980c197890f9cac70d49444956213

Instructions:

cd api-ts
yarn
yarn generate 

I have a sample openapi spec that I've just got from the offical website. https://oai.github.io/Documentation/examples/tictactoe.yaml

I generate the code as per your instructions.

The issue is that:

In models.ts - the types are Pascal cased: (I agree with this convention btw)

/**
 * A text message describing an error
 */
export type ErrorMessage = string;
export type Coordinate = number;
/**
 * Possible values for a board square. `.` means empty square.
 */
export type Mark = "." | "X" | "O";
export type Board = [
  [Mark, Mark, Mark],
  [Mark, Mark, Mark],
  [Mark, Mark, Mark]
];

However the attempt at imports of these models are lowercased:

/* eslint-disable */
import {
  errorMessage,
  coordinate,
  mark,
  board,
  winner,
  status,
} from "./models";

I imagine this is because in the original spec the models are all defined lower case.

As a workaround I could define those components in Pascal case in the original spec. But this does seem like a bug.

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