opg
Rust OpenAPI 3.0 docs generator
#### Example:
> Or see more [here](https://github.com/Rexagon/opg/tree/master/test_suite/tests)
```rust
use opg::*;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(rename_all = "camelCase")]
#[opg("Simple enum")]
enum SimpleEnum {
Test,
Another,
Yay,
}
#[derive(Serialize, Deserialize, OpgModel)]
#[opg("newtype string", format = "id", example = "abcd0001")]
struct NewType(String);
#[derive(Serialize, Deserialize, OpgModel)]
struct SimpleStruct {
first_field: i32,
#[opg("Field description")]
second: String,
}
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(rename_all = "kebab-case")]
enum ExternallyTaggedEnum {
Test(String),
AnotherTest(String, #[opg("Second")] String),
}
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(untagged)]
enum UntaggedEnum {
First {
value: NewType,
},
#[opg("Variant description")]
Second {
#[opg("Inlined struct", inline)]
another: SimpleStruct,
},
}
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(tag = "tag", rename_all = "lowercase")]
enum InternallyTaggedEnum {
First(SimpleStruct),
Second { field: String },
}
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(tag = "tag", content = "content", rename_all = "lowercase")]
enum AdjacentlyTaggedEnum {
First(String),
Second(NewType, NewType),
}
#[derive(Serialize, Deserialize, OpgModel)]
#[serde(rename_all = "camelCase")]
struct TypeChangedStruct {
#[serde(with = "chrono::naive::serde::ts_milliseconds")]
#[opg("UTC timestamp in milliseconds", integer, format = "int64")]
pub timestamp: chrono::NaiveDateTime,
}
#[derive(Serialize, Deserialize, OpgModel)]
struct StructWithComplexObjects {
#[serde(skip_serializing_if = "Option::is_none")]
#[opg(optional)]
super_optional: Option