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

Schema correction for ActC #377

Merged

Conversation

e-backmark-ericsson
Copy link
Member

@e-backmark-ericsson e-backmark-ericsson commented Dec 21, 2023

Applicable Issues

Closes #376

Description of the Change

Updated the event schema for ActC with correct spelling of 'additionalProperties', in a new major version of the event. The major version is stepped for clarity, even though it could be considered a backwards compatible change by most consumers. A producer that faultily add additional properties to this event will now need to be updated, so from a producer point-of-view this change is non-backwards compatible.
No old event version was altered.

Alternate Designs

.

Benefits

Correct event schema for ActC

Possible Drawbacks

None

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Emil Bäckmark [email protected]

@e-backmark-ericsson e-backmark-ericsson requested a review from a team as a code owner December 21, 2023 09:10
@e-backmark-ericsson e-backmark-ericsson marked this pull request as draft December 21, 2023 09:10
@e-backmark-ericsson e-backmark-ericsson marked this pull request as ready for review December 21, 2023 09:24
@e-backmark-ericsson
Copy link
Member Author

e-backmark-ericsson commented Dec 21, 2023

Should we really correct the old schemas, as I've done in the last commit, or should we let them be and just create a new version of the faulty event schema? I actually think so, but then we can not include a validation of all old event schemas...

Copy link
Member

@magnusbaeck magnusbaeck left a comment

Choose a reason for hiding this comment

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

Nice, hadn't thought to check for the existence of a metaschema.

I don't see how we can just fix the old schemas. We don't even fix documentation problems in old schema files and here we're making changes that affect the semantics. But yes, we'd then have to ignore the ActC files up to and including 3.2.0.

Strictly speaking, fixing the misspelling in a new event version might actually be a backwards incompatible change even though it's technically just a bugfix.

test_jsonschema.py Outdated Show resolved Hide resolved
test_jsonschema.py Outdated Show resolved Hide resolved
@e-backmark-ericsson
Copy link
Member Author

I'll commit the updates and then we should discuss how to deal with old schemas and with the non-backwards compatible issue.

@e-backmark-ericsson
Copy link
Member Author

Discussed Jan 4 with Magnus:

  • Split this PR in two PRs. One for testing schema validity and one for fixing the ActC bug. Schema validation for old ActC version should neglect those errors, with a reference to the bug.
  • Fixing the ActC bug should step the major version of the event, for clarity, even though it could be considered a backwards compatible change for many consumers. No old event version should be altered.

@e-backmark-ericsson e-backmark-ericsson changed the title Add test for valid schema Correct schema for ActC Jan 4, 2024
@e-backmark-ericsson e-backmark-ericsson changed the title Correct schema for ActC Schema correction for ActC Jan 4, 2024
Copy link
Member

@m-linner-ericsson m-linner-ericsson left a comment

Choose a reason for hiding this comment

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

I am usually for stepping version when changing files but like to discuss the consequences of correcting this without stepping the versions.

@e-backmark-ericsson
Copy link
Member Author

I am usually for stepping version when changing files but like to discuss the consequences of correcting this without stepping the versions.

I agree, and that is what is done in this PR. The bug is corrected in a new version of the ActC event, with a new major version on it.

@e-backmark-ericsson
Copy link
Member Author

@m-linner-ericsson , given the recent TC discussions and the newly created issue #390, are you ok with approving this PR?

@m-linner-ericsson
Copy link
Member

@m-linner-ericsson , given the recent TC discussions and the newly created issue #390, are you ok with approving this PR?

What about the TODO in the PR description?

TODO: Clarify why major version is stepped

@e-backmark-ericsson
Copy link
Member Author

@m-linner-ericsson , given the recent TC discussions and the newly created issue #390, are you ok with approving this PR?

What about the TODO in the PR description?

TODO: Clarify why major version is stepped

I think that comment was left there without a valid reason. Anyway, I updated the description text slightly now for some more clarity on why the major version is stepped.

@e-backmark-ericsson
Copy link
Member Author

Rebased

Current diff:

$ python3 diff_definitions.py origin/master
diff -u definitions/EiffelActivityCanceledEvent/3.2.0.yml definitions/EiffelActivityCanceledEvent/4.0.0.yml
diff -u schemas/EiffelActivityCanceledEvent/3.2.0.json schemas/EiffelActivityCanceledEvent/4.0.0.json

$ diff -u definitions/EiffelActivityCanceledEvent/3.2.0.yml definitions/EiffelActivityCanceledEvent/4.0.0.yml
--- definitions/EiffelActivityCanceledEvent/3.2.0.yml   2024-01-16 08:41:26.371764600 +0100
+++ definitions/EiffelActivityCanceledEvent/4.0.0.yml   2024-01-16 08:41:26.373301100 +0100
@@ -1,4 +1,4 @@
-# Copyright 2017-2023 Ericsson AB and others.
+# Copyright 2017-2024 Ericsson AB and others.
 # For a full list of individual contributors, please see the commit history.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,7 +44,7 @@
   - meta
   - data
   - links
-additonalProperties: false
+additionalProperties: false
 _links:
   ACTIVITY_EXECUTION:
     description: Declares the activity execution that was canceled.
@@ -94,6 +94,8 @@
       types:
         - EiffelFlowContextDefinedEvent
 _history:
+  - version: 4.0.0
+    changes: Fix bug in schema regarding additionalProperties (see [Issue 376](https://github.com/eiffel-community/eiffel/issues/376)).
   - version: 3.2.0
     introduced_in: edition-arica
     changes: Add schema URL to the meta object (see [Issue 280](https://github.com/eiffel-community/eiffel/issues/280)).

$ diff -u schemas/EiffelActivityCanceledEvent/3.2.0.json schemas/EiffelActivityCanceledEvent/4.0.0.json
--- schemas/EiffelActivityCanceledEvent/3.2.0.json      2024-01-16 08:44:09.120670000 +0100
+++ schemas/EiffelActivityCanceledEvent/4.0.0.json      2024-01-16 08:44:09.164362000 +0100
@@ -18,9 +18,9 @@
         "version": {
           "type": "string",
           "enum": [
-            "3.2.0"
+            "4.0.0"
           ],
-          "default": "3.2.0"
+          "default": "4.0.0"
         },
         "time": {
           "type": "integer"
@@ -184,5 +184,5 @@
     "data",
     "links"
   ],
-  "additonalProperties": false
+  "additionalProperties": false
 }

@e-backmark-ericsson e-backmark-ericsson merged commit 1b9a637 into eiffel-community:master Jan 17, 2024
2 checks passed
@e-backmark-ericsson e-backmark-ericsson deleted the issue_376 branch January 18, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Json keyword misspelled in all ActC yaml files
3 participants