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

Unable to deser the "Basic Structure" example from the OpenAPI v2 spec #41

Open
pwoolcoc opened this issue Jun 9, 2020 · 1 comment

Comments

@pwoolcoc
Copy link

pwoolcoc commented Jun 9, 2020

this crate is unable to deserialize the document shown here, in the OpenAPI v2 spec: https://swagger.io/docs/specification/2-0/basic-structure/ . It fails with the following error:

---- test_basic_structure stdout ----
thread 'test_basic_structure' panicked at 'Couldn't deser doc: Yaml(Message("data did not match any variant of untagged enum OpenApi", None))', src/lib.rs:34:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is the code I used to generate the error:

#[test]
fn test_basic_structure() {
    use std::io::{self, Cursor};

    let doc = r#"swagger: "2.0"
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0

host: api.example.com
basePath: /v1
schemes:
  - https

paths:
  /users:
    get:
      summary: Some text
      description: Some more text
      produces:
        - application/json
      responses:
        200:
          description: OK"#.to_string();

    let bytes = doc.as_bytes().to_vec();
    let mut bytes = Cursor::new(bytes);

    let api = openapi::from_reader(&mut bytes).expect("Couldn't deser doc");
}
@pwoolcoc
Copy link
Author

I think this is related to this serde_yaml issue, if so I will close this: dtolnay/serde-yaml#165

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