Commit 3f9c027
authored
codegen: create a file per model (#5365)
Should address #5287
Relevant changes are clearer after
#5366 which commits some
incidental refactoring
Adds a new `openapiSeperateFilesForModels` flag with default `false` so
as not to needlessly break user code (my downstream refactor after
enabling this was mostly just find+replace, but still chonky and with
edge-cases)
The `nifi_test` now uses this new flag; it's a pretty large spec, so
this provides good coverage, whilst also reducing the number of lines in
our expectations (this is the sole reason for the diff having more
deleted lines than added).
Writing the output files gets wrapped in a `Future.traverse` now because
writing >1000 model files can be slower than it needs to be, otherwise.
Type aliases are now sorted alphabetically in output.
Inline enums now get written immediately after the 'container' object,
rather than at the start of the file. This wasn't a particularly
intentional change, but it aligns with the fact that, when 'splitting'
to separate files, inline defns will live with the parent. The ordering
change should have no impact on user code (although it did cause a bit
of churn in test expectations...)
Incidentally fixes an issue with 'deduplicated' file structure when
using zio or circe serdes and reusing a json-y Map[String T] or Array[T]
type alias1 parent 4681cdb commit 3f9c027
40 files changed
Lines changed: 945 additions & 4605 deletions
File tree
- doc/generator
- openapi-codegen
- core/src
- main/scala/sttp/tapir/codegen
- dedup
- json
- security
- test/scala/sttp/tapir/codegen
- sbt-plugin/src
- main/scala/sttp/tapir/sbt
- sbt-test/sbt-openapi-codegen
- nifi_test
- oneOf-json-roundtrip-zio
- oneOf-json-roundtrip_jsoniter
- oneOf-json-roundtrip_scala3
- oneOf-json-roundtrip
- petstore
- schema_inheritance
- seperate_files_for_models
- project
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
Lines changed: 135 additions & 107 deletions
Large diffs are not rendered by default.
Lines changed: 29 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 16 | + | |
28 | 17 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 18 | + | |
| 19 | + | |
39 | 20 | | |
| 21 | + | |
40 | 22 | | |
41 | 23 | | |
42 | 24 | | |
| |||
140 | 122 | | |
141 | 123 | | |
142 | 124 | | |
143 | | - | |
| 125 | + | |
| 126 | + | |
144 | 127 | | |
145 | 128 | | |
146 | 129 | | |
| |||
162 | 145 | | |
163 | 146 | | |
164 | 147 | | |
165 | | - | |
| 148 | + | |
| 149 | + | |
166 | 150 | | |
167 | 151 | | |
168 | 152 | | |
| |||
203 | 187 | | |
204 | 188 | | |
205 | 189 | | |
206 | | - | |
| 190 | + | |
| 191 | + | |
207 | 192 | | |
208 | 193 | | |
209 | 194 | | |
| |||
255 | 240 | | |
256 | 241 | | |
257 | 242 | | |
258 | | - | |
| 243 | + | |
| 244 | + | |
259 | 245 | | |
260 | 246 | | |
261 | 247 | | |
| |||
270 | 256 | | |
271 | 257 | | |
272 | 258 | | |
273 | | - | |
| 259 | + | |
| 260 | + | |
274 | 261 | | |
275 | 262 | | |
276 | 263 | | |
| |||
504 | 491 | | |
505 | 492 | | |
506 | 493 | | |
507 | | - | |
508 | | - | |
| 494 | + | |
| 495 | + | |
509 | 496 | | |
510 | 497 | | |
511 | 498 | | |
| |||
520 | 507 | | |
521 | 508 | | |
522 | 509 | | |
523 | | - | |
| 510 | + | |
| 511 | + | |
524 | 512 | | |
525 | 513 | | |
526 | 514 | | |
| |||
557 | 545 | | |
558 | 546 | | |
559 | 547 | | |
560 | | - | |
| 548 | + | |
561 | 549 | | |
562 | 550 | | |
563 | 551 | | |
| |||
685 | 673 | | |
686 | 674 | | |
687 | 675 | | |
688 | | - | |
| 676 | + | |
| 677 | + | |
689 | 678 | | |
690 | 679 | | |
691 | 680 | | |
| |||
721 | 710 | | |
722 | 711 | | |
723 | 712 | | |
724 | | - | |
| 713 | + | |
725 | 714 | | |
726 | 715 | | |
727 | 716 | | |
| |||
758 | 747 | | |
759 | 748 | | |
760 | 749 | | |
| 750 | + | |
761 | 751 | | |
762 | 752 | | |
763 | | - | |
| 753 | + | |
764 | 754 | | |
765 | 755 | | |
766 | 756 | | |
767 | 757 | | |
768 | 758 | | |
769 | | - | |
770 | | - | |
771 | | - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
772 | 762 | | |
773 | 763 | | |
774 | 764 | | |
| |||
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 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 | + | |
69 | 120 | | |
Lines changed: 0 additions & 49 deletions
This file was deleted.
0 commit comments