Skip to content

fix: Dynamically lookup schema when simply a module #631

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

Closed

Conversation

oceanlewis
Copy link

Changes the Cast logic to attempt to lookup the schema when given a module as a :schema.

Addresses these issues:

@oceanlewis oceanlewis force-pushed the dynamically-lookup-schema branch from 5e44189 to d42366e Compare August 23, 2024 19:38
@oceanlewis oceanlewis force-pushed the dynamically-lookup-schema branch from d42366e to c7b2591 Compare August 26, 2024 21:03
@mbuhot
Copy link
Collaborator

mbuhot commented Aug 30, 2024

Thanks for the PR @oceanlewis. I'm closing this one since OpenAPISpex is designed to have Schema modules resolved to %References{} immediately after constructing the %OpenApi{}, as per the example in the README:

  @impl OpenApi
  def spec do
    %OpenApi{
      servers: [
        # Populate the Server info from a phoenix endpoint
        Server.from_endpoint(Endpoint)
      ],
      info: %Info{
        title: "My App",
        version: "1.0"
      },
      # Populate the paths from a phoenix router
      paths: Paths.from_router(Router)
    }
    |> OpenApiSpex.resolve_schema_modules() # Discover request/response schemas from path specs
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants