Repository navigation
Settle three API names before 1.1.0, and hold the OpenAPI specs to kebab-case - #2826
Merged
Merged
Conversation
…t asset_id Context: - GET /sensors/<id>/status gained an asset_id query parameter in #2474, after v1.0.1, so it has not shipped in a release yet. - New wire names are kebab-case, and a single word where it can be (#2540); the sensor listing already takes asset, with asset_id as a legacy alias. Change: - Rename the query parameter to asset, without a legacy alias, as no release accepted asset_id. - Update the sensor status page, which is its only caller. - The regenerated OpenAPI specs also pick up the PATCH asset description from #2825, which main's specs had not caught up with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context: - DELETE /sensors/<id>/data and DELETE /sensors/<id>/annotations took start and until, where POST annotations and every other time window in the API take start and end. - DELETE /sensors/<id>/annotations is new in 1.1.0; DELETE /sensors/<id>/data shipped with until. Change: - Name the second bound end on both endpoints, in their schemas, validation messages and descriptions. - Keep accepting until on DELETE /sensors/<id>/data, as a legacy alias for end; the annotations endpoint never shipped with until, so it gets no alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context: - GET /sensors/<id>/status had no API test, so renaming its query parameter could not break one. Change: - Check that the status reports the sensor's relation to the asset named by asset, and to its own asset by default. - Fails when the parameter is spelled asset_id again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context: - Both DELETE sensor endpoints now name their second bound end; only DELETE /sensors/<id>/data keeps accepting until. Change: - Send end in the existing tests of both endpoints. - Run the data endpoint's end filter test with until as well, which fails when the alias is dropped. - Check that the annotations endpoint refuses until, which fails when it is given the alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
…mes too
Context:
- The test on wire names walks the Marshmallow schemas defined in FlexMeasures modules.
- A parameter declared inline, as in use_kwargs({...}), gets a schema that Marshmallow generates in its own module, so the asset_id query parameter of GET /sensors/<id>/status (#2474) went unnoticed.
- Response fields built as plain dicts and documented on their endpoint have no schema to walk at all.
Change:
- Check the query, header and cookie parameters and the body properties named in the published OpenAPI specs against the same list of names that predate kebab-case.
- Add the 14 names that only the specs reveal, all of which shipped in v1.0.1, to that list.
- Count names found in the specs when looking for stale entries in it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context: - The API change log called two response fields next_run and n_jobs, where automation responses send next-run and the automation trigger sends n-jobs; the main changelog and the trigger endpoint's description said the same. - The previous commits renamed the status endpoint's asset_id to asset, and the DELETE endpoints' until to end. Change: - Correct next-run and n-jobs in the API change log, the main changelog and the trigger endpoint's description. - Describe the status endpoint's asset parameter and the annotations endpoint's end under their own entries. - Note that DELETE /sensors/<id>/data takes end, still accepting until, which is deprecated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context: - PR #2826 renames until to end on DELETE /sensors/<id>/data, keeping until as a deprecated alias, and widens the naming test to the published OpenAPI specs. Change: - Add the DELETE /sensors/<id>/data change under API and plugins. - Extend the naming test's existing entry with what it now covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz Signed-off-by: F.N. Claessen <claessen@seita.nl>
Documentation build overview
4 files changed± changelog.html± _autosummary/flexmeasures.api.v3_0.sensors.html± api/change_log.html± api/v3_0.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Settles the API names that 1.1.0 would otherwise ship in a spelling we'd have to support, and widens the naming test that should have caught one of them.
GET /sensors/<id>/statustakesasset, notasset_id. The query parameter came in with Fix what the asset status page reports about its sensors #2474, after v1.0.1, so no release acceptedasset_idand it is renamed without an alias. The sensor status page, its only caller, is updated. The sensor listing already takesasset(withasset_idas a legacy alias), so the two now agree.startandend. They tookstartanduntil, wherePOST .../annotationsand every other time window in the API takestartandend.DELETE /sensors/<id>/datashipped withuntil, so it keeps acceptinguntilas a deprecated alias (viaSupportsLegacyFieldAliases).DELETE /sensors/<id>/annotationsis new in 1.1.0, so it takes no alias and refusesuntilwith a 422.test_field_naming.py(Hold new field names to kebab-case, and list the ones that predate it #2547) walks the Marshmallow schemas defined in FlexMeasures modules. That missedasset_id, because a parameter declared inline, as in@use_kwargs({"asset": AssetIdField(data_key="asset_id")}), gets a schema that Marshmallow generates in its own module. Response fields built as plain dicts have no schema to walk either. Two new tests check the query/header/cookie parameters and the body properties named in the specs against the same list of names that predate kebab-case. The 14 names only the specs reveal all shipped in v1.0.1, so they join that list. The stale-entry test now counts names found in the specs too.next_runandn_jobs, where the API sendsnext-runandn-jobs. The main changelog and the automation trigger's description had the same slips. It now also describesassetandendabove, and the deprecation ofuntil.documentation/changelog.rstThe regenerated OpenAPI specs also pick up the PATCH asset description from #2825, which main's specs had not caught up with.
Look & Feel
A new snake_case parameter in the specs now fails like this:
How to test
pytest flexmeasures/data/schemas/tests/test_field_naming.pypytest flexmeasures/api/v3_0/tests/test_sensors_api.py -k statuspytest flexmeasures/api/v3_0/tests/test_sensors_delete_data_fresh_db.py flexmeasures/api/v3_0/tests/test_annotations.pyEach new test was checked against the change it covers:
asset_idagain fails the status test;untilalias fails the data endpoint'suntilcase;Further Improvements
staleness_sinceandasset_name. The new property check does not see those: the endpoint documents them only as examples, not as a schema.Related Items
Follows up on #2547 and #2474.
Sign-off
🤖 Generated with Claude Code
https://claude.ai/code/session_01DWv6v5ELzmj2eBM1L4GTBz