odahu / odahu-flow

Apache License 2.0
12 stars 2 forks source link

Cannot create an entity through `Swagger` if one contains the `number` field where the str is expected #633

Open BPylypenko opened 2 years ago

BPylypenko commented 2 years ago

Description When the user tries to create an entity through Swagger API from a JSON file that contains number fields, it returns the error:

{ "message": "json: cannot unmarshal number into Go struct field ResourceList.spec.resources.limits.cpu of type string" }.

Steps to Reproduce

  1. Go to API Gateway page of ODAHU Web UI.
  2. Try to create model training where spec.model.version or ....cpu contains integers.
  3. Notice that Swagger perceive this as valid JSON (allows execution), but the error is returned:

    { "message": "json: cannot unmarshal number into Go struct field ResourceList.spec.resources.limits.cpu of type string" }.

Actual result When the user tries to create an entity from a JSON file with number fields through Swagger API, it returns the error:

{ "message": "json: cannot unmarshal number into Go struct field ResourceList.spec.resources.limits.cpu of type string" }.

Expected result The user can create an entity from a JSON file which contains number fields through Swagger API.

Attachments image

Environment: