swagger-api / swagger-api/swagger-codegen

Swagger Codegen does not generate validation information for typescript-angular2

Open
#6,410 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: TypeScript Enhancement: Feature help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I use swagger-codegen to generate an API for typescript-angular2.

The Swagger JSON file contains as well additional information. e.g. minLength, maxLength of a string:

"AppointmentViewModel": {
"required": [
"Title"
],
"type": "object",
"properties": {
"Id": {
"format": "int32",
"type": "integer"
},
"Ansprechpartner": {
"maxLength": 100,
"minLength": 0,
"type": "string"
},

Issue: I cannot find this information (minLength,maxLength) in the generated code. Does swagger-coden for typescript-angular2 not support this or do is miss something?

Swagger-codegen version

2.2.3

Command line used for generation

java -jar ./swagger-codegen-cli-2.2.3.jar generate -i http://example.ch/swagger/docs/v1 -l typescript-angular2 -o ./src/api -DsupportES6=true -DmodelPropertyNaming=original

Steps to reproduce

Generate code with additional information like minLength, maxLength.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with swagger-codegen-cli-2.2.3 using the documented command and Swagger JSON containing minLength and maxLength. Inspect the generated typescript-angular2 model output to determine where validation metadata is lost; done means the generated code represents the specified string constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.