We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
opg does not support generic structs.
opg
#[derive(Debug, serde::Serialize, opg::OpgModel)] struct TestStruct<T: std::fmt::Debug> { inner: T, } #[derive(Debug, serde::Serialize, opg::OpgModel)] struct TestSubStruct1 { a: i32, b: i64, } #[derive(Debug, serde::Serialize, opg::OpgModel)] struct TestSubStruct2<'a> { c: &'a i32, d: String, } describe_api!( info: { title: "title", description: "description", version: "0.1.0", }, paths: { ("some" / "path" / "one"): { GET: { description: "Get smth 1", 200: TestStruct<TestSubStruct1>, }, }, ("some" / "path" / "two"): { GET: { description: "Get smth 1", 200: TestStruct<TestSubStruct2<'static>>, }, }, } )
Converts to this:
--- openapi: 3.0.3 info: title: title description: description version: 0.1.0 paths: /some/path/one: get: description: Get smth 1 responses: 200: description: OK content: application/json: schema: $ref: "#/components/schemas/TestStruct" /some/path/two: get: description: Get smth 1 responses: 200: description: OK content: application/json: schema: $ref: "#/components/schemas/TestStruct" components: schemas: TestStruct: type: object properties: inner: $ref: "#/components/schemas/TestSubStruct1" required: - inner TestSubStruct1: type: object properties: a: type: integer format: int32 b: type: integer format: int64 required: - a - b
There is the only first TestStruct<TestSubStruct1> type.
TestStruct<TestSubStruct1>
The text was updated successfully, but these errors were encountered:
Is there any news about it? It looks pretty useful
Sorry, something went wrong.
No branches or pull requests
opg
does not support generic structs.Converts to this:
There is the only first
TestStruct<TestSubStruct1>
type.The text was updated successfully, but these errors were encountered: