Skip to content

Handling "default" in request body schema #206

@cdent

Description

@cdent

(Apologies if I'm getting the nature of "default" completely wrong, but...)

I have an openapi3 request body schema which includes:

          "group_by_time": {
            "default": true,
            "description": "Aggregate data over the provided time range, using the provided resolution. Default: true",
            "type": "boolean"
          },

For me, the ideal result of RequestBodyValidation would be a changed body that has "group_by_time": true if it is not otherwise set. I can think of many of reasons why this is a bad idea: req.Body -> JSON -> to new JSON -> to new Body is icky.

Also it doesn't appear that the json visitor would make the changes, as currently written.

So what is the correct or preferred way of achieving this? Should I simply be checking/setting the default in my code.

If there is a way to make this possible in the kin-openapi, I'm happy to work on the code if someone pushes me in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions