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

JSON schema doesn't have link objects validations for Eiffel events #148

Closed
Umadevi-Kapu opened this issue Jul 11, 2017 · 8 comments
Closed
Assignees

Comments

@Umadevi-Kapu
Copy link
Contributor

From https://github.com/Ericsson/eiffel/blob/master/eiffel-syntax-and-usage/the-links-object.md,
we notice that few links are specific to Few Eiffel Events,

For Example: EiffelActivityCanceledEvent
Required : ACTIVITY_EXECUTION
Optional : CAUSE/CONTEXT, FLOW_CONTEXT

Today in schema there is no validation on the type field in links array object. We have tried to cover half of this (Few Links specific to Few events) in this pull request #147.
We did not find ways in which we can cover mandatory and optional links without hardcoding the links in each event instead of type and value.

@d-stahl-ericsson
Copy link
Contributor

Hi! Sorry for the late reply - I've been on vacation.

I have given this issue some thought myself. Schema validation of links would be great, but it's easier said than done. As you indicate, there are two types of checks that can be made:

  1. Ensure that required links are present
  2. Ensure that no links other than defined ones are present

The first would be very valuable, but I'm uncertain whether it can be done with JSON schema. Perhaps using oneOf? If I get the time I'll try it out...

The second is easily done, but unfortunately it shuts down the protocol. Additional link types should not be prohibited. If I wish to extend the protocol by defining my own DanielsCandyFlossCreatedEvent and want to reference it from other events using a CANDY_FLOSS link type, then that's perfectly fine. The current PR to this issue disallows that, though.

@d-stahl-ericsson
Copy link
Contributor

My mistake. The keyword I was thinking of was "contains", not "oneOf". I'll play around a bit and see if I can make something work.

@d-stahl-ericsson
Copy link
Contributor

d-stahl-ericsson commented Aug 3, 2017

Unfortunately the current version of jsonschema doesn't support draft 6 (where "contains" is introduced). See python-jsonschema/jsonschema#337

I tried working around this with the following:

      "not": {
        "items": {
          "properties": {
            "type": {
              "not": {
                "enum": ["IUT"]
              }
            }
          }
        }
      }

Problem is I can't make that work for multiple required types (consider EiffelArtifactReusedEvent, which requires REUSED_ARTIFACT and COMPOSITION). Perhaps there's a way that I just don't see? Otherwise, I suggest we put this on hold and revisit it when jsonschema support draft 6.

What we easily can do, however, is to support validation of UUID syntax in links. I think I'll make a PR to that effect...

@d-stahl-ericsson
Copy link
Contributor

This is related to #136, by the way.

@d-stahl-ericsson
Copy link
Contributor

Quick update: still no draft6 support :( Would be neat if we could contribute to jsonschema to help fix that, but the time can be found right now.

@d-stahl-ericsson d-stahl-ericsson changed the title JSON schema doesn't have link objects validations for Eiffel2.0 events JSON schema doesn't have link objects validations for Eiffel events Feb 19, 2018
@magnusbaeck
Copy link
Member

AFAICT draft 6 support is available now so it should be possible to start working on this issue.

@Umadevi-Kapu
Copy link
Contributor Author

Umadevi-Kapu commented Nov 8, 2019

Thanks. We will look into it.

@e-backmark-ericsson
Copy link
Member

This issue is now considered solved thanks to #380 . That PR only covers the aspect of validating the existence of mandatory link types. The schema does not validate that all provided link types are valid.

@github-project-automation github-project-automation bot moved this from In Review to Done in Eiffel Protocol Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants