Materials-Consortia/optimade-python-tools

Stricten requirements on base info fields

Opened this issue · 4 comments

The cited fields in OPTIMADE have quite strictly defined values, IMO:

formats: List[str] = StrictField(
default=["json"], description="List of available output formats."
)
available_endpoints: List[str] = StrictField(
...,
description="List of available endpoints (i.e., the string to be appended to the versioned base URL).",
)
entry_types_by_format: Dict[str, List[str]] = StrictField(
..., description="Available entry endpoints as a function of output formats."
)

  • Items of formats must match regex ^(json|_.*)$
  • Items of available_endpoints are as well limited to the supported endpoints plus ^_
  • entry_types_by_format are essentially limited by the same requirements

Do you mean specifically in the OpenAPI schema @merkys ? We already validate against these constraints (except format, as shown in the linked code) but perhaps we could also patch them into the output schema

Oh right! I meant I would like to see them in the OpenAPI schema.

That we can do! I'll take a look before we release 1.2

Thanks, this would be nice to have. Then multipurpose OpenAPI/JSON validators would validate OPTIMADE responses with similar level of strictness.