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 generation fails with a Map[String, List[String]] #2916

Closed
countfloyd opened this issue Jun 17, 2024 · 5 comments
Closed

OpenAPI generation fails with a Map[String, List[String]] #2916

countfloyd opened this issue Jun 17, 2024 · 5 comments
Labels
💎 Bounty bug Something isn't working 💰 Rewarded

Comments

@countfloyd
Copy link

For a field of type Map[String, List[String]] (or List of anything for that matter), the OpenAPI generator fails

Run this program to reproduce:

import zio.http.endpoint.openapi.JsonSchema
import zio.http.endpoint.openapi.JsonSchema.SchemaStyle
import zio.schema.*

import scala.collection.immutable.List

@main def schema(): Unit =
  val schema = Schema.map[String, List[String]]
  val s = JsonSchema.fromZSchemaMulti(schema, SchemaStyle.Reference)
  println(s.toString)

The OpenAPI generation should succeed. Instead, get this exception:

Exception in thread "main" java.util.NoSuchElementException: None.get
	at scala.None$.get(Option.scala:627)
	at scala.None$.get(Option.scala:626)
	at zio.http.endpoint.openapi.JsonSchema$.fromZSchemaMulti(JsonSchema.scala:378)
	at com.g1.esg1.v10n.web.schema$package$.schema(schema.scala:25)
	at com.g1.esg1.v10n.web.schema.main(schema.scala:23)
  • OS: macOS 14.5
  • Version Java 22

Using zio-http 3.0.0-RC8 and Scala 3.4.2

@countfloyd countfloyd added the bug Something isn't working label Jun 17, 2024
@jdegoes
Copy link
Member

jdegoes commented Jul 30, 2024

/bounty $75 for test case and fix.

Copy link

algora-pbc bot commented Jul 30, 2024

## 💎 $75 bounty • ZIO

### Steps to solve:
1. Start working: Comment /attempt #2916 with your implementation plan
2. Submit work: Create a pull request including /claim #2916 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 bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @pawelsadlo Aug 1, 2024, 9:07:26 PM #2996

@pawelsadlo
Copy link
Contributor

pawelsadlo commented Aug 1, 2024

/attempt #2916

Copy link

algora-pbc bot commented Aug 1, 2024

💡 @pawelsadlo submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Aug 2, 2024

🎉🎈 @pawelsadlo has been awarded $75! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty bug Something isn't working 💰 Rewarded
Projects
None yet
Development

No branches or pull requests

4 participants