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

oneOf doesn't work with rust-server #3297

Open
jamessewell opened this issue Jul 8, 2019 · 2 comments
Open

oneOf doesn't work with rust-server #3297

jamessewell opened this issue Jul 8, 2019 · 2 comments

Comments

@jamessewell
Copy link

Description

When I use oneOf with Rust-server output I get the following Rust code in my model:

pub targets: Vec<oneOf<PolygonTarget,CircleTarget,AlertTarget>>,

oneOf isn't defined anywhere, and I can't compile.

@wing328
Copy link
Member

wing328 commented Jul 8, 2019

I don't think we've added oneOf support to rust-server generator.

What does the correct code look like?

@jamessewell
Copy link
Author

Oh right ... is that documented somewhere?

When I do the generation it says:

[main] INFO o.o.codegen.DefaultGenerator - Generator 'rust-server' is considered stable.

If it doesn't cover the whole OpenAPI spec I think maybe it should be mentioned there or not listed as stable?

Let me think about the correct code overnight - worst case you'd need an enum per oneOf:

enum oneOfPolygonTargetCircleTargetAlertTarget {
  PolygonTarget,
  CircleTarget,
  AlertTarget
}

(with all the Serde magic it needs) Then use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants