Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@anovis
Copy link
Collaborator

@anovis anovis commented Oct 18, 2023

closes #442

class StopLight(Enum):
    green = 'green'
    yellow = 'yellow'
    red = 'red'


@app.route("/{color}")
def prim_enum(color: StopLight):
    return StopLight(color)

returns openapi spec as follows

      - in: path
        name: color
        required: true
        type: string
        enum:
        - green
        - yellow
        - red

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (b248c87) 89.72% compared to head (4dfda2b) 89.73%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #446      +/-   ##
==========================================
+ Coverage   89.72%   89.73%   +0.01%     
==========================================
  Files          62       62              
  Lines        5673     5691      +18     
==========================================
+ Hits         5090     5107      +17     
- Misses        583      584       +1     
Files Coverage Δ
goblet/__version__.py 100.00% <100.00%> (ø)
goblet/handlers/routes.py 93.87% <100.00%> (+0.06%) ⬆️
goblet/tests/test_openapispec.py 95.16% <93.33%> (-0.11%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anovis anovis merged commit 8e9a2f2 into main Oct 18, 2023
@anovis anovis deleted the enum-param branch October 18, 2023 19:52
quajones pushed a commit to quajones/goblet that referenced this pull request Oct 19, 2023
closes goblet#442
```
class StopLight(Enum):
    green = 'green'
    yellow = 'yellow'
    red = 'red'

@app.route("/{color}")
def prim_enum(color: StopLight):
    return StopLight(color)
```

returns openapi spec as follows

```
      - in: path
        name: color
        required: true
        type: string
        enum:
        - green
        - yellow
        - red
 ```
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 this pull request may close these issues.

[Routes] - Enum type as parameter

2 participants