Skip to content

PB-2354: OpenAPI: Group properties by extension - #662

Merged
asteiner-swisstopo merged 1 commit into
developfrom
feat-pb-2354-openapi-group-properties-by-extension
Sep 7, 2026
Merged

PB-2354: OpenAPI: Group properties by extension#662
asteiner-swisstopo merged 1 commit into
developfrom
feat-pb-2354-openapi-group-properties-by-extension

Conversation

@asteiner-swisstopo

Copy link
Copy Markdown
Contributor

Changed the schema of "properties" to group the fields by STAC extension:

  • Core Properties
    • created
    • datetime
    • start_datetime
    • end_datetime
    • updated
    • title
  • Timestamps extension
    • expires
  • Forecast extension
    • forecast:reference_datetime
    • forecast:horizon
    • forecast:duration
    • forecast:variable
    • forecast:perturbed
  • CF extension
    • cf:standard_name
    • unit

With the anyOf, SwaggerUI renders these groups into groups that can be clicked. That should make the understanding easier.

pb-2354-openapi-properties-grouped-by-extension

On the other side, technically the OpenAPI specs are now incorrect: As it is now, you could, for example, have this:

{
    "properties":
    "expires": "2018-02-12T23:20:50Z"
}

while in fact some of the core properties are always mandatory and you would rather have something like this:

{
    "properties":
    "created": "2018-02-12T23:20:50Z",
    "updated": "2018-02-12T23:20:50Z",
    "datetime": "2018-02-12T23:20:50Z",
    "expires": "2018-02-12T23:20:50Z",
}

Another sideeffect of this change is that the example payload only shows the core properties, not all properties anymore:

"properties": {
    "created": "2018-02-12T23:20:50Z",
    "updated": "2018-02-12T23:20:50Z",
    "datetime": "2018-02-12T23:20:50Z",
    "start_datetime": "2018-02-12T23:20:50Z",
    "end_datetime": "2018-02-12T23:20:50Z",
    "title": "Feature title"
},

We decided to still go with the incorrect OpenAPI schema because it makes it more explicit.

Changed the schema of "properties" to group the fields by STAC
extension:

- Core Properties
    - created
    - datetime
    - start_datetime
    - end_datetime
    - updated
    - title
- Timestamps extension
    - expires
- Forecast extension
    - forecast:reference_datetime
    - forecast:horizon
    - forecast:duration
    - forecast:variable
    - forecast:perturbed
- CF extension
    - cf:standard_name
    - unit

With the `anyOf`, SwaggerUI renders these groups into groups that can be
clicked. That should make the understanding easier.

On the other side, technically the OpenAPI specs are now incorrect: As
it is now, you could, for example, have this:

```json
{
"properties":
"expires": "2018-02-12T23:20:50Z"
}
```

while in fact some of the core properties are always mandatory and you
would rather have something like this:

```json
{
"properties":
"created": "2018-02-12T23:20:50Z",
"updated": "2018-02-12T23:20:50Z",
"datetime": "2018-02-12T23:20:50Z",
"expires": "2018-02-12T23:20:50Z",
}
```

Another sideeffect of this change is that the example payload only shows
the core properties, not all properties anymore:

```json
"properties": {
"created": "2018-02-12T23:20:50Z",
"updated": "2018-02-12T23:20:50Z",
"datetime": "2018-02-12T23:20:50Z",
"start_datetime": "2018-02-12T23:20:50Z",
"end_datetime": "2018-02-12T23:20:50Z",
"title": "Feature title"
},
```

We decided to still go with the incorrect OpenAPI schema because it
makes it more explicit.
@asteiner-swisstopo asteiner-swisstopo self-assigned this Aug 26, 2026
@github-actions github-actions Bot added the feature New feature or enhancement label Aug 26, 2026

@boecklic boecklic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not 100% ideal to have an "incorrect" spec, but I have no better idea right now, let's proceed with this.

@asteiner-swisstopo
asteiner-swisstopo merged commit f92a2f5 into develop Sep 7, 2026
7 checks passed
@asteiner-swisstopo
asteiner-swisstopo deleted the feat-pb-2354-openapi-group-properties-by-extension branch September 7, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants