Commit d06115c
committed
ci(python-flask): add CI workflow to actually run the Connexion 3 sample
Adds .github/workflows/samples-python-flask-connexion3-server.yaml,
mirroring the existing samples-python-fastapi-server.yaml pattern, to
install the generated useConnexion3 sample's own requirements and run its
generated pytest suite on every change to that folder. This closes the
"known gap" called out in the original PR description: no CI job actually
installs/runs the generated python-flask server (the pre-existing
samples-python-server.yaml only covers python-aiohttp-srclayout).
Getting the generated test suite to actually pass cleanly (rather than
shipping a new CI job that's red from day one) surfaced a real bug in the
skip-marking logic added here:
PythonFlaskConnexionServerCodegen now overrides
postProcessOperationsWithModels to skip-mark, under useConnexion3, the
generated test for any operation that declares multiple response content
types (e.g. both application/xml and application/json, the standard
Petstore convention). Connexion 3 requires the handler to explicitly say
which content type it's returning in that case; the auto-generated stub
controllers don't, so calling them raises a 500
(NonConformingResponseHeaders) until the operation is actually
implemented. This mirrors the exact mechanism the parent class already
uses for other known Connexion limitations (unsupported/multiple
consumes) -- same x-skip-test vendor extension, same
@unittest.skip(reason) rendering in controller_test.mustache. Also
skip-marks the two operations with array-typed request bodies
(createUsersWithArrayInput/ListInput) for a separate, pre-existing,
version-agnostic reason: the auto-generated test example for an
array-typed body is a single item, not an array, which fails request
validation regardless of Connexion version. Under Connexion 2 this
happens to be masked because those same two operations are already
skipped for an unrelated reason (a `*/*` consumes quirk that, for reasons
not fully understood, does not trigger the same way under useConnexion3's
config path); under Connexion 3 the pre-existing example bug surfaces on
its own. Skip-marked with an honest reason rather than left failing or
silently hidden.
Diagnosing why the skip markers weren't showing up in the generated
output at all (despite the Java code demonstrably running and mutating
the right objects, confirmed via temporary debug logging) took a while:
DefaultGenerator never overwrites an api-test-template file
(controller_test.mustache -> test_*_controller.py) that already exists on
disk, specifically so it doesn't clobber a user's own edits to their
generated tests. Since this sample's test files were first generated
many regenerations ago, every run since had been silently skipping them
regardless of any template or codegen changes -- this fix only actually
landed in the committed output after deleting the existing test/
directory once so the next regen would write it fresh. (Supporting files
like __init__test.mustache -> test/__init__.py aren't subject to this
rule, which is why earlier changes to that file always showed up
correctly and this one didn't.)
Also tried and reverted a spec-level fix: adding an explicit `example:`
to the UserArray requestBody in
modules/openapi-generator/src/test/resources/3_0/python-flask/petstore.yaml,
hoping it would override the codegen's auto-synthesized single-object
example for the array-typed body. Verified directly that it made no
difference to the generated test data, so reverted it rather than leave
a no-op change in the spec, and used the skip-marking approach above
instead.
Verified clean end-to-end, replicating the new workflow's exact steps
(Python 3.11, `pip install -r requirements.txt && pip install -r
test-requirements.txt`, `pytest`) in Docker against the final regenerated
sample: 8 passed, 13 skipped, 0 failed. Also reran the existing
PythonFlaskConnexionServerCodegenTest and a full `bin/generate-samples.sh`
double-regen across all 766 generators -- both clean, with the diff
scoped to exactly the files above (confirmed the v2 default sample and
.openapi-generator/FILES manifest are both unaffected, once compared
against the correct post-regeneration steady state rather than a
one-off fresh-generation artifact).1 parent 7b0bbc0 commit d06115c
5 files changed
Lines changed: 105 additions & 0 deletions
File tree
- .github/workflows
- modules/openapi-generator/src/main/java/org/openapitools/codegen/languages
- samples/server/petstore/python-flask-connexion3/openapi_server/test
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
59 | 122 | | |
60 | 123 | | |
61 | 124 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| |||
0 commit comments