connexion-example icon indicating copy to clipboard operation
connexion-example copied to clipboard

Path parameters converted to integers

Open HeliosAnavatis opened this issue 5 years ago • 0 comments

Fairly new to Python and Connexion.

I have a definition:

  - in: path
    name: orgid
    schema:
      type: string
    required: true
    description: ID of the organisation

and the function that provides information on this URL: def getOrgById (schemeid,orgid):

Some organisation ids are all numeric. I can convert them to a string, and that's fine but if the organisation id starts with a '0', it gets lopped off.
/organisations/1234 is OK but /organisations/0563 breaks - because the value of orgid in the function is '563' .

How can I ensure that the parameter is passed to the function as a string and not an integer? Specifying it as a string in the YAML ought to be enough, I'd have thought.

HeliosAnavatis avatar Dec 18 '19 12:12 HeliosAnavatis