Skip to content

Support adding custom field to operation object (view function) #571

@RemyNtshaykolo

Description

@RemyNtshaykolo

Hi, is there anyway to specify custom fields (starting with x-) for a given route with a metadata parameter in the doc decorator?

@app.route("/compute-intermodal-routes-co2eq", methods=["GET"])
@app.doc(
    summary="Compute intermodal routes CO2eq emissions",
    description="This intermodal routing API endpoint ",
    security=[{"api_key": []}],
    metadata={"x-conf": {"lambda": {"memory_size": 1000, "concurrent_execution": -1}}},
)

For now I am using spec_processor

@app.spec_processor
def get_spec(spec):
    spec["paths"]["/compute-intermodal-routes-co2eq"]["get"]["x-conf"] = {
        "lambda": {"memory_size": 200, "concurrent_execution": -1},
        "throttling": {"rateLimit": 10, "burstLimit": 1},
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions