Skip to content

Conversation

@RolandMa1986
Copy link

@RolandMa1986 RolandMa1986 commented Jul 6, 2022

Support openapi extensions.
https://swagger.io/docs/specification/openapi-extensions/

The extened properties start with "x_" and will be coverted to "x-" in json.

    #[openapi(x_my_property=3)]
    pub some_property: Option<i32>,

Output:

{
      "type": "object",
      "properties": {
          "some_property": {
              "x-my-property": 3,
              "type": "integer",
              "format": "int32"
          }
}

Signed-off-by: Roland Ma <rolandma@outlook.com>
Signed-off-by: Roland Ma <rolandma@outlook.com>
Signed-off-by: Roland Ma <rolandma@outlook.com>
Signed-off-by: Roland Ma <rolandma@outlook.com>
@RolandMa1986
Copy link
Author

@tiagolobocastro would you like to take a look at this PR?

@tiagolobocastro tiagolobocastro changed the title support custorm properties support custom properties Aug 8, 2022
Copy link
Collaborator

@tiagolobocastro tiagolobocastro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RolandMa1986 sorry this has slipped through the nets.
Could you please add a test for custom properties?

let mut schema = DefaultSchemaRaw {
name: Some(#schema_name.into()),
example: #example,
extensions:#extensions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add space?

let mut schema = DefaultSchemaRaw {
name: Some(Self::__paperclip_schema_name()), // Add name for later use.
example: #example,
extensions:#extensions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add space?

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

Successfully merging this pull request may close these issues.

2 participants