Skip to content

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

@guizmaii

Description

@guizmaii

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? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions