Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert OpenAPI version number to 3.0.0 #1210

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### 41.4.6 [#1210](https://github.com/openfisca/openfisca-core/pull/1210)

#### Technical changes

- Abide by OpenAPI v3.0.0 instead of v3.1.0
- Drop support for `propertyNames` in `Values` definition

### 41.4.5 [#1209](https://github.com/openfisca/openfisca-core/pull/1209)

#### Technical changes
Expand Down
6 changes: 3 additions & 3 deletions openfisca_web_api/openAPI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: "3.1.0"
openapi: "3.0.0"

info:
title: "{COUNTRY_PACKAGE_NAME} Web API"
Expand Down Expand Up @@ -137,8 +137,8 @@ components:
type: "object"
additionalProperties:
$ref: "#/components/schemas/Value"
propertyNames: # this keyword is part of JSON Schema but is not supported in OpenAPI Specification at the time of writing, see https://swagger.io/docs/specification/data-models/keywords/#unsupported
pattern: "^[12][0-9]{3}-[01][0-9]-[0-3][0-9]$" # all keys are ISO dates
# propertyNames: # this keyword is part of JSON Schema but is not supported in OpenAPI v3.0.0
# pattern: "^[12][0-9]{3}-[01][0-9]-[0-3][0-9]$" # all keys are ISO dates

Comment on lines +140 to +141
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand that we are dropping propertyNames because it wasn't and is not supported by OpenAPI and that we are keeping it here as documentation for humans.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is actually a revert of 8be2ec4: this was always documented this way and full JSON Schema support was added in OpenAPI v3.1. However, as documented in this PR and in 2091cd6, v3.1 needs a big Swagger UI update that we unfortunately cannot afford at the moment.

Value:
oneOf:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
"idna >=3.4, < 4.0",
"isort >=5.12.0, < 6.0",
"mypy >=1.1.1, < 2.0",
"openapi-spec-validator >=0.5.6, < 0.6.0",
"openapi-spec-validator >=0.7.1, < 0.8.0",
"pycodestyle >=2.10.0, < 3.0",
"pylint >=2.17.1, < 3.0",
"xdoctest >=1.1.1, < 2.0",
] + api_requirements

setup(
name="OpenFisca-Core",
version="41.4.5",
version="41.4.6",
author="OpenFisca Team",
author_email="[email protected]",
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions tests/web_api/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import dpath.util
import pytest
from openapi_spec_validator import openapi_v3_spec_validator
from openapi_spec_validator import OpenAPIV30SpecValidator


def assert_items_equal(x, y):
Expand Down Expand Up @@ -62,4 +62,4 @@ def test_situation_definition(body):


def test_respects_spec(body):
assert not [error for error in openapi_v3_spec_validator.iter_errors(body)]
assert not [error for error in OpenAPIV30SpecValidator(body).iter_errors()]
Copy link
Collaborator

Choose a reason for hiding this comment

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

👌

Seen in this documentation (pdf). Also in the source code of openapi_spec_validator, OpenAPIV30SpecValidator and openapi_v3_spec_validator.

Loading