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 doc generation] What should be generated for a case object? #3222

Open
guizmaii opened this issue Nov 27, 2024 · 0 comments
Open

[OpenAPI doc generation] What should be generated for a case object? #3222

guizmaii opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@guizmaii
Copy link
Member

guizmaii commented Nov 27, 2024

Given the following endpoint:

sealed trait Example
final case class A(a: Int) extends Example
case object B extends Example

final case class Input(example: Option[Example])

val testEndpoint = 
  (Endpoint(RoutePattern.POST / "test") ?? Doc.p("This is my 'POST /test' endpoint doc"))
    .in[Input]
    .out[String](mediaType = MediaType.application.json, doc = Doc.p("this is the output doc"))

val spec: String =
  OpenAPIGen.fromEndpoints(
    title = "This is my OpenAPI doc title",
    version = "0.0.0",
    endpoints = List(testEndpoint)
  ).toJson

What is the correct thing to generate for case object B in the OpenAPI doc?

Right now, we generate something like this:

      "B": {
        "type": "object",
        "properties": {

        }
      },

Is this correct? 🤔

@guizmaii guizmaii added the bug Something isn't working label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant