Skip to content

How to use ToSchema with generated protobuf structs? #267

Answered by boan-anbo
boan-anbo asked this question in Q&A
Discussion options

You must be logged in to vote

Solved by making changes to prost-build process, adding type_attribute.

  • Add the following to prost_build::Config::()
.field_attribute("DistantApiSearchResponse.passages", "#[schema(value_type=Vec<Passage>)]")
  • This will let Utoipa's wonderful ToSchema macros take care of changing the $ref.

  • Now the new schema looks like:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by boan-anbo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant