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

[python-flask] regex pattern causes generation fails. #9220

Closed
HugoMario opened this issue Mar 1, 2019 · 0 comments · Fixed by #9251
Closed

[python-flask] regex pattern causes generation fails. #9220

HugoMario opened this issue Mar 1, 2019 · 0 comments · Fixed by #9251
Milestone

Comments

@HugoMario
Copy link
Contributor

Description

Having a property with regex pattern, inside a model, makes generation process crash. This is because according commit a4d4b0 Python has a different regex convention for modifier.

Swagger-codegen version

2.4.1

Swagger declaration file content or url
swagger: "2.0"
info:
  description: "allOf issue demonstration"
  version: "1.0.0"
  title: "Swagger allOf regression"
host: "example.com"
schemes:
- "http"
paths:
  /rides:
    post:
      tags:
      - "rides"
      summary: "Add a new ride"
      description: ""
      operationId: "addRide"
      parameters:
      - in: "body"
        name: "body"
        description: "Ride object"
        required: true
        schema:
          $ref: "#/definitions/Ride"
      responses:
        405:
          description: "Invalid input"
definitions:
  Ride:
    type: "object"
    required:
    - "from"
    - "to"
    properties:
      id:
        type: "integer"
        format: "int64"
      from:
        type: "string"
        example: "London"
      to:
        type: "string"
        example: "Manchester"
      date-time:  
        $ref: '#/definitions/GLOBAL_DateTime'
  GLOBAL_DateTime:
    type: string
    format: date-time
    pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{1,7})?Z'
Suggest a fix/enhancement

I'm not familiar with Python, playing a bit with this issue i placed a / at beginning and at end on pattern and seems to work, but that looks more like a hack instead a real solution.

So any suggestion is welcome

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

Successfully merging a pull request may close this issue.

1 participant