Skip to content

Question about Axios template #409

@mxmory

Description

@mxmory

Generated axios request template:
Screenshot 2022-09-07 at 23 28 24

I have 2 different schemas for request and response:

Request schema: (id and color are optional to create this entity)

StageModel {
  id?: number;
  name: string;
  color?: string;
  ...
  ...
}

Response schema: (no optional fields because I'm sure they will be presented in response and don't want typescript to complain like 'id' is possibly undefined in future use in my react components)

StageModelResponse {
  id: number;
  name: string;
  color: string;
  ...
  ...
}

So the question is: can I generate different types and put them to axios request and response respectively? Or maybe I'm doing this all wrong and this can be achieved in more correct/elegant way? Someone help please! Thanks in advance 🙏

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