open-api-spex / open_api_spex

Open API Specifications for Elixir Plug applications
Mozilla Public License 2.0
706 stars 183 forks source link

Clash of different schemas with the same title #587

Open juise opened 9 months ago

juise commented 9 months ago

In case I have two schema definitions with the same title, one schema is overwritten by another:

  defmodule Wallet do
    require OpenApiSpex

    OpenApiSpex.schema(%{
      title: "Wallet",
  ...

and

  defmodule GeneralizedWallet do
    require OpenApiSpex

    OpenApiSpex.schema(%{
      title: "Wallet",
  ...

in this case, I every time got GeneralizedWallet instead of Wallet in places where it's awaited in request_body. It seems like the problem in schema_resolver.resolve_schema_modules_from_schema/2 (https://github.com/open-api-spex/open_api_spex/blob/e4deef525d09110b17d5320f6bd35f9fefca9705/lib/open_api_spex/schema_resolver.ex#L200-L249). It seems like it should be some pre-processing entities in compile time to verify such clash?