Skip to content

Response models are not being used to validate responses #461

Closed
@drnextgis

Description

@drnextgis

I've got confused by the fact that response models are not being used to validate responses. Isn't that its main purpose? As you can see here for example response model is Collection. But if we modify collection's content in the database (pgstac) in order not to be align with the response model stac-fastapi simple ignores it and returns what we have in the database without any warning/error:

$ postgis=# UPDATE collections SET content = JSONB_SET(content, '{type}', '"MyCollection"');
$ curl -s -X 'GET' \
  'http://localhost:8082/collections/joplin' \
  -H 'accept: application/json' | jq '.type'
"MyCollection"

But according to the response model type should be Collection.

ENABLE_RESPONSE_MODELS set to true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions