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

Inappropriate recursion? #7

Open
Quafadas opened this issue Aug 16, 2024 · 0 comments
Open

Inappropriate recursion? #7

Quafadas opened this issue Aug 16, 2024 · 0 comments

Comments

@Quafadas
Copy link
Contributor

  case class File(
      id: String,
      `object`: String,
      bytes: Long,
      created_at: Long,
      filename: String,
      purpose: String
  ) derives Schema

  case class FileList(
      data: List[File],
      `object`: String
  ) derives Schema

gives;

io.github.quafadas.dairect.filesApi#FileList: Found invalid shape recursion: io.github.quafadas.dairect.filesApi#FileList$data > io.github.quafadas.dairect.filesApi#FileList. A structure cannot be mutually recursive through all required members.

My naive reading of the deriving codebase suggests this is to do with a collision when autogenerating smithy collection shape names. With this information, a simple workaround (note the y appended) is;

  case class FileListy(
      data: List[File],
      `object`: String
  ) derives Schema

Recorded for posterity.

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

No branches or pull requests

1 participant