Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

case confusion in the generated output. #13

Open
dwjohnston opened this issue May 2, 2022 · 0 comments
Open

case confusion in the generated output. #13

dwjohnston opened this issue May 2, 2022 · 0 comments

Comments

@dwjohnston
Copy link

dwjohnston commented May 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant