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

Openapi big model hierarchy defect #3436

Closed

Conversation

mhodovaniuk
Copy link

@mhodovaniuk mhodovaniuk commented Mar 28, 2025

This PR aim to fix #3361 by making sure that Schema.Transform are not ignored.

This also fixes an issue where a reference was used instead of component details. See the components are generated for model with abstract big model field test. Before these changes, the result lacked ConcreteBigModel details.
Open API spec that generated without this change:

{
   "openapi":"3.1.0",
   "info":{
      "title":"",
      "version":""
   },
   "paths":{
      "/api/v1/endpoint":{
         "get":{
            "responses":{
               "200":{
                  "content":{
                     "application/json":{
                        "schema":{
                           "$ref":"#/components/schemas/WithGenericPayload"
                        }
                     }
                  }
               }
            }
         }
      }
   },
   "components":{
      "schemas":{
         "AbstractBigModel":{
            "oneOf":[
               {
                  "$ref":"#/components/schemas/ConcreteBigModel"
               }
            ],
            "discriminator":{
               "propertyName":"type",
               "mapping":{
                  "ConcreteBigModel":"#/components/schemas/ConcreteBigModel"
               }
            }
         },
         "ConcreteBigModel":{
            "$ref":"#/components/schemas/ConcreteBigModel"
         },
         "WithGenericPayload":{
            "type":"object",
            "properties":{
               "a":{
                  "$ref":"#/components/schemas/AbstractBigModel"
               }
            },
            "required":[
               "a"
            ]
         }
      }
   }
}

@CLAassistant
Copy link

CLAassistant commented Mar 28, 2025

CLA assistant check
All committers have signed the CLA.

mhodovaniuk and others added 25 commits March 28, 2025 14:05
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: Jules Ivanic <[email protected]>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
* cookie-based authentication

* add security related properties.

* fmt.

* remove extra ZIO.succeed.
* docs: example doing what the surrounding text promises

* docs: reflect actual section order; link to the referenced section

* docs: delete a duplicate paragraph

* docs: delete repeated words

* docs: delete a word out of place

* docs: typos

---------

Co-authored-by: John A. De Goes <[email protected]>
* Provide a `Scope` per server call (zio#3197)

* Scope handling for handlers (zio#3197)

* Scope handling for handlers (zio#3197)
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
* Align Client SSE support to HTML specification

* Fix scala 2.12 compilation

* Fix server side retry duration conversion

* Fix formatting

* Client will retry if route installation is too slow

* Switch to route.runZIO in the tests instead

* Adjust ServerSentEvent.retry documentation

* Do not emit negative retry values

* Use zio.http.Charsets for SSE

* Add SSE constructor that takes retry as int value
* fix: display endpoint documentation in swagger ui

* sbt fmt

---------

Co-authored-by: Nabil Abdel-Hafeez <[email protected]>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: Jules Ivanic <[email protected]>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: Jules Ivanic <[email protected]>
Co-authored-by: Nabil Abdel-Hafeez <[email protected]>
…#3337)

* Make newly added Routes take precedence over old ones (zio#3066)

* Ensure uniqueness of routes when creating look up tree
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
* Update scalafmt-core, scalafmt-dynamic to 3.9.3

* Reformat with scalafmt 3.9.3

Executed command: scalafmt --non-interactive

* Add 'Reformat with scalafmt 3.9.3' to .git-blame-ignore-revs

---------

Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
zio-assistant bot and others added 27 commits March 28, 2025 14:05
Co-authored-by: ZIO Assistant <zio-assistant[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
zio#3416)

Right now, the logger I see in my project is `zio-slf4j-logger` while I'd expect something like `zio.http.<whatever>`
…ort (zio#3396)

* Enhancement zio#3283 : added server side jks keystore truststore support

* Enhancement zio#3283 : scalafix

* Enhancement zio#3283 : add doc

* Enhancement zio#3283 : fix doc compilation
…io#3418)

* Handle `Schema.Transform` in `StringSchemaCodec.emptyStringIsValue`

(zio#3417)

* Mark test as flaky
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: Nabil Abdel-Hafeez <[email protected]>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: Jules Ivanic <[email protected]>
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
* initial commit

* fix: Pattern match error in Endpoint.scala

* updated Endpoint.scala, fix test, digestAuth test

* revert CodeGen.scala

* updated endpoint docs

* added scopes to AuthType

* removed comment

* updated SecurityRequirement documentation

* implemented ScopedAuth, updated name in auth HeaderType

* Endpoint.scopes method, made authScopes recursive

* getter & setter for scopes in ScopedAuth, private recursive getter for scopes in Endpoint API

* updated ScopedAuth, mima check fix

* mima check fix
* docs: Config reference

* scalafmt

* scalafix

* simplify

* delete entries of configs which only appear nested in others

* make zio-http-gen visible to zio-http-docs

* docs: Config reference: each config on a separate page

because Table.toGithubFlavouredMarkdown() assumes it owns the page and
the anchor IDs clash when multiple configs are dumped on a single page

* website: sidebar: fix document IDs

* docs: Config reference: shorten sidebar labels

* docs: Config reference: introduction page

* Update zio-config to 4.0.4

---------

Co-authored-by: Nabil Abdel-Hafeez <[email protected]>
* Improve `From#toQueryParams` performance (zio#3289)

* Improve `From#toQueryParams` performance (zio#3289)
…ibrary is not on the classpath by default (zio#3426)

* make uring provided and document

* add more documentation around uring

* fix typos

* clarify
Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
Co-authored-by: ZIO Assistant <zio-assistant[bot]@users.noreply.github.com>
…s the full schema instead of just a reference.
@mhodovaniuk mhodovaniuk force-pushed the openapi-big-model-hierarchy-defect branch from 0913fad to 3157a4b Compare March 28, 2025 12:06
@mhodovaniuk mhodovaniuk deleted the openapi-big-model-hierarchy-defect branch March 28, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet