Commit e62974f
* fix: preserve property order in auto-generated examples
The openapi-yaml generator was using HashMap when building object-level
examples from property examples, which caused unstable field ordering
that didn't match the source spec declaration order.
Switch to LinkedHashMap to preserve the order as defined in the
OpenAPI spec. This improves readability in Swagger UI and other
downstream tools that render the auto-generated examples.
Add test to verify property order preservation.
* fix: Preserve field order in auto-generated object-level examples (#23664)
The openapi-yaml generator was using HashMap when building object-level
examples from property examples, which caused unstable field ordering
that didn't match the source spec declaration order.
Switch to LinkedHashMap to preserve the order as defined in the
OpenAPI spec. This improves readability in Swagger UI and other
downstream tools that render the auto-generated examples.
Add test to verify property order preservation.
* fix: update samples after preserving field order in auto-generated examples
---------
Co-authored-by: Swapneswar Sundar Ray <jayaguru@macbookair.mynetworksettings.com>
1 parent 49e548f commit e62974f
445 files changed
Lines changed: 5265 additions & 5189 deletions
File tree
- modules/openapi-generator/src
- main/java/org/openapitools/codegen/examples
- test/java/org/openapitools/codegen
- samples
- client
- echo_api
- csharp/restsharp/net8/EchoApi/api
- go/api
- java
- apache-httpclient/api
- feign-gson/api
- native/api
- okhttp-gson-user-defined-templates/api
- okhttp-gson/api
- restclient/api
- resteasy/api
- resttemplate/api
- others/java
- okhttp-gson-streaming/api
- restclient-sealedInterface/api
- webclient-sealedInterface_3_1/api
- webclient-sealedInterface/api
- petstore
- csharp
- generichost
- latest
- NullTypes/api
- UseDateTimeOffset/api
- net10
- AllOf/api
- FormModels/api
- NullReferenceTypes/api
- Petstore/api
- SourceGeneration/api
- net4.7
- AllOf/api
- FormModels/api
- Petstore/api
- net4.8
- AllOf/api
- FormModels/api
- Petstore/api
- net8
- AllOf/api
- FormModels/api
- NullReferenceTypes/api
- Petstore/api
- SourceGeneration/api
- net9
- AllOf/api
- FormModels/api
- NullReferenceTypes/api
- Petstore/api
- SourceGeneration/api
- standard2.0/Petstore/api
- httpclient
- net10
- Petstore-nonPublicApi/api
- Petstore/api
- net9
- Petstore-nonPublicApi/api
- Petstore/api
- standard2.0/Petstore/api
- restsharp
- net10
- EnumMappings/api
- Petstore/api
- net4.7
- MultipleFrameworks/api
- Petstore/api
- net4.8/Petstore/api
- net8
- EnumMappings/api
- Petstore/api
- useVirtualForHooks/api
- net9/EnumMappings/api
- standard2.0
- ConditionalSerialization/api
- Petstore/api
- unityWebRequest
- net10/Petstore/api
- net9/Petstore/api
- standard2.0/Petstore/api
- go/go-petstore/api
- java
- apache-httpclient-jackson3/api
- apache-httpclient/api
- feign-hc5/api
- feign-no-nullable/api
- feign/api
- google-api-client/api
- jersey2-java8-localdatetime/api
- jersey2-java8/api
- jersey3/api
- native-async/api
- native-jackson3-jspecify/api
- native-jackson3/api
- native-jakarta/api
- native-useGzipFeature/api
- native/api
- okhttp-gson-3.1/api
- okhttp-gson-awsv4signature/api
- okhttp-gson-dynamicOperations/src/main/resources/openapi
- okhttp-gson-group-parameter/api
- okhttp-gson-nullable-required/api
- okhttp-gson-parcelableModel/api
- okhttp-gson-swagger1/api
- okhttp-gson-swagger2/api
- okhttp-gson/api
- rest-assured-jackson/api
- rest-assured/api
- restclient-nullable-arrays/api
- restclient-springBoot4-jackson2/api
- restclient-springBoot4-jackson3-jspecify/api
- restclient-springBoot4-jackson3/api
- restclient-swagger2/api
- restclient-useSingleRequestParameter-static/api
- restclient-useSingleRequestParameter/api
- restclient/api
- resteasy/api
- resttemplate-jakarta/api
- resttemplate-springBoot4-jackson2/api
- resttemplate-springBoot4-jackson3-jspecify/api
- resttemplate-springBoot4-jackson3/api
- resttemplate-swagger1/api
- resttemplate-swagger2/api
- resttemplate-withXml/api
- resttemplate/api
- retrofit2-play26/api
- retrofit2rx2/api
- retrofit2rx3/api
- retrofit2/api
- vertx-no-nullable/api
- vertx-supportVertxFuture/api
- vertx5-supportVertxFuture/api
- vertx5/api
- vertx/api
- webclient-jakarta/api
- webclient-nullable-arrays/api
- webclient-springBoot4-jackson3-jspecify/api
- webclient-springBoot4-jackson3/api
- webclient-swagger2/api
- webclient-useSingleRequestParameter/api
- webclient/api
- documentation
- html2
- html
- openapi3
- client/petstore
- go-petstore-generateMarshalJSON-false/api
- go-petstore-withXml/api
- go
- go-petstore-aws-signature/api
- go-petstore/api
- java
- jersey2-java8-special-characters/api
- jersey2-java8-swagger1/api
- jersey2-java8-swagger2/api
- jersey2-java8/api
- spring-stubs/src/main/java/org/openapitools/api
- server/petstore
- go/go-petstore/api
- spring-boot-oneof-interface/src/main
- java/org/openapitools/api
- resources
- spring-boot-oneof-sealed/src/main
- java/org/openapitools/api
- resources
- spring-boot-oneof/src/main
- java/org/openapitools/api
- resources
- spring-boot-springdoc/src/main
- java/org/openapitools/api
- resources
- springboot-3-include-http-request-context/src/main
- java/org/openapitools/api
- resources
- springboot-3/src/main
- java/org/openapitools/api
- resources
- springboot-4-jspecify/src/main/java/org/openapitools/api
- springboot-4/src/main
- java/org/openapitools/api
- resources
- springboot-delegate/src/main
- java/org/openapitools/api
- resources
- springboot-implicitHeaders/src/main
- java/org/openapitools/api
- resources
- springboot-source/src/main
- java/org/openapitools/api
- resources
- springboot/src/main
- java/org/openapitools/api
- resources
- server
- echo_api/erlang-server/priv
- petstore
- aspnetcore-3.0/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-3.1/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-5.0/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-6.0-NewtonsoftFalse/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-6.0-nullableReferenceTypes/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-6.0-pocoModels/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-6.0-project4Models/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-6.0-useSwashBuckle/src/Org.OpenAPITools/Controllers
- aspnetcore-6.0/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-NewtonsoftFalse/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-abstract-class/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-nullableReferenceTypes/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-pocoModels/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-project4Models/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-use-centralized-package-version-management/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore-8.0-useSwashBuckle/src/Org.OpenAPITools/Controllers
- aspnetcore-8.0/src/Org.OpenAPITools
- Controllers
- wwwroot
- aspnetcore/src/Org.OpenAPITools
- Controllers
- wwwroot
- erlang-server/priv
- go-api-server/api
- go-chi-server/api
- go-echo-server/.docs/api
- go-gin-api-server-interface-only/api
- go-gin-api-server/api
- java-camel/src/main/java/org/openapitools/api
- java-helidon-server
- v3
- mp/src/main/resources/META-INF
- se/src/main/resources/META-INF
- v4
- mp/src/main/resources/META-INF
- se-uac-group-by-file-path/src/main/resources/META-INF
- se-uac/src/main/resources/META-INF
- se/src/main/resources/META-INF
- java-play-framework-api-package-override/public
- java-play-framework-async/public
- java-play-framework-controller-only/public
- java-play-framework-fake-endpoints-with-security/public
- java-play-framework-fake-endpoints/public
- java-play-framework-no-bean-validation/public
- java-play-framework-no-excp-handling/public
- java-play-framework-no-interface/public
- java-play-framework-no-nullable/public
- java-play-framework-no-wrap-calls/public
- java-play-framework/public
- java-undertow/src/main/resources/config
- java-vertx-web/src/main/resources
- java-wiremock/src/main/java/org/openapitools/mockserver/api
- jaxrs-spec-interface-response/src/main/openapi
- jaxrs-spec-interface/src/main/openapi
- jaxrs-spec-jakarta/src/main/openapi
- jaxrs-spec-microprofile-openapi-annotations/src/main/resources/META-INF
- jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF
- jaxrs-spec-required-and-readonly-property/src/main/openapi
- jaxrs-spec-swagger-annotations/src/main/openapi
- jaxrs-spec-swagger-v3-annotations-jakarta/src/main/openapi
- jaxrs-spec-swagger-v3-annotations/src/main/openapi
- jaxrs-spec-withxml/src/main/openapi
- jaxrs-spec/src/main/openapi
- kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/apis
- kotlin-server
- ktor2-usetags-false/src/main/kotlin/org/openapitools/server/apis
- ktor2/src/main/kotlin/org/openapitools/server/apis
- ktor/src/main/kotlin/org/openapitools/server/apis
- kotlin-spring-default/src/main/resources
- kotlin-springboot-bigdecimal-default/src/main/resources
- kotlin-springboot-delegate/src/main
- kotlin/org/openapitools/api
- resources
- kotlin-springboot-modelMutable/src/main/resources
- kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api
- kotlin-springboot-reactive-without-flow/src/main/resources
- kotlin-springboot-reactive/src/main/resources
- kotlin-springboot-source-swagger1/src/main/resources
- kotlin-springboot-source-swagger2/src/main/resources
- python-aiohttp-srclayout/src/openapi_server/openapi
- python-fastapi
- python-flask/openapi_server/openapi
- rust-server-deprecated/output
- openapi-v3/api
- petstore-with-fake-endpoints-models-for-testing/api
- rust-server-test/api
- rust-server/output
- openapi-v3/api
- petstore-with-fake-endpoints-models-for-testing/api
- rust-server-test/api
- springboot-beanvalidation-no-nullable/src/main
- java/org/openapitools/api
- resources
- springboot-beanvalidation/src/main
- java/org/openapitools/api
- resources
- springboot-builtin-validation/src/main
- java/org/openapitools/api
- resources
- springboot-delegate-j8/src/main
- java/org/openapitools/api
- resources
- springboot-delegate-no-response-entity/src/main
- java/org/openapitools/api
- resources
- springboot-delegate/src/main
- java/org/openapitools/api
- resources
- springboot-implicitHeaders-annotationLibrary/src/main
- java/org/openapitools/api
- resources
- springboot-implicitHeaders/src/main
- java/org/openapitools/api
- resources
- springboot-include-http-request-context/src/main
- java/org/openapitools/api
- resources
- springboot-lombok-data/src/main
- java/org/openapitools/api
- resources
- springboot-lombok-tostring/src/main
- java/org/openapitools/api
- resources
- springboot-petstore-with-api-response-examples/src/main
- java/org/openapitools/api
- resources
- springboot-reactive-noResponseEntity/src/main/resources
- springboot-reactive/src/main
- java/org/openapitools/api
- resources
- springboot-sort-validation/src/main/resources
- springboot-spring-pageable-delegatePattern-without-j8/src/main
- java/org/openapitools/api
- resources
- springboot-spring-pageable-delegatePattern/src/main
- java/org/openapitools/api
- resources
- springboot-spring-pageable-without-j8/src/main
- java/org/openapitools/api
- resources
- springboot-spring-pageable/src/main
- java/org/openapitools/api
- resources
- springboot-useoptional/src/main
- java/org/openapitools/api
- resources
- springboot-virtualan/src/main
- java/org/openapitools/virtualan/api
- resources
- springboot-x-implements-skip/src/main
- java/org/openapitools/api
- resources
- springboot/src/main
- java/org/openapitools/api
- resources
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| |||
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
334 | 337 | | |
335 | 338 | | |
336 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
337 | 413 | | |
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
702 | 701 | | |
| 702 | + | |
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
717 | 716 | | |
| 717 | + | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | 729 | | |
| 730 | + | |
734 | 731 | | |
735 | | - | |
736 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
737 | 737 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
702 | 701 | | |
| 702 | + | |
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
717 | 716 | | |
| 717 | + | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | 729 | | |
| 730 | + | |
734 | 731 | | |
735 | | - | |
736 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
737 | 737 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| |||
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
769 | | - | |
770 | 769 | | |
| 770 | + | |
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
785 | 784 | | |
| 785 | + | |
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 797 | | |
| 798 | + | |
802 | 799 | | |
803 | | - | |
804 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| |||
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
769 | | - | |
770 | 769 | | |
| 770 | + | |
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
785 | 784 | | |
| 785 | + | |
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 797 | | |
| 798 | + | |
802 | 799 | | |
803 | | - | |
804 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
769 | | - | |
770 | 769 | | |
| 770 | + | |
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
785 | 784 | | |
| 785 | + | |
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 797 | | |
| 798 | + | |
802 | 799 | | |
803 | | - | |
804 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| |||
0 commit comments