zio / zio-http

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers
https://zio.dev/zio-http
Apache License 2.0
787 stars 396 forks source link

Adding ?? Doc.p(...) to an Endpoint with a tag overwrites the tag #3131

Closed countfloyd closed 1 week ago

countfloyd commented 4 weeks ago

Consider an endpoint:

  val testEndpoint =
    Endpoint(RoutePattern.POST / "api" / "test")
      .tag("My Tag")
      .in[String]
      .out[String]
      ?? Doc.p("Endpoint documentation")

If I look at the OpenAPI docs generated for this endpoint, the tag is missing. I think the ?? Doc call is overwriting the tag since the tag seems to be part of the endpoint's documentation.

geeeezmo commented 3 weeks ago

You can do Doc.p("...").tag("My Tag"), and that would keep the tag, but then another thing comes up: the description for the endpoint gets replaced with - My Tag\n, and the path also gets the same value in description 🤔

jdegoes commented 3 weeks ago

/bounty $75 for fix and test cases.

These operators should all be "append-only", i.e. they do not discard existing information.

algora-pbc[bot] commented 3 weeks ago

💎 $75 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #3131 with your implementation plan
  2. Submit work: Create a pull request including /claim #3131 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bounty • Share on socials

Attempt Started (GMT+0) Solution
🟢 @987Nabil #3147
algora-pbc[bot] commented 5 hours ago

🎉🎈 @987Nabil has been awarded $75! 🎈🎊