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

Handling of conflicting external references from different YARRRML documents? #131

Open
SvenLieber opened this issue Aug 18, 2021 · 1 comment

Comments

@SvenLieber
Copy link

Issue type: ❓ Question

(This issue is related to the PR #127 which will add the feature of populating external references from .env files)

I am currently facing the issue of the spec being not clear on a specific feature which is offered by the current version of the yarrrml-parser.

According to the parser documentation several YARRRML documents can be provided:

You can use multiple input files too: yarrrml-parser -i rules-1.yml -i rules-2.yml. They are converted to a single RML document. Note that the keys in prefixes, sources, and mappings have to be unique across all files

Furthermore the documentation says that

When you do not provide a value for an external reference, the reference will not be replaced.

However, how should a case be handled where conflicting external references exist in several provided YARRRML documents?

Partial solution via prioritization

As discussed internally, the prioritized order to replace external references should be

  1. Use provided reference values via the -e argument
  2. Use values provided via the external object inside a YARRRML document
  3. Use values provided via an .env file

Whereas this order specifies how to deal with possibly conflicting external references across command line, YARRRML document and environment (namely by following the provided prioritization), it does not specify how to deal with conflicting external references within each of these approaches.

For 1 and 3 the solution could look the following:

  • Conflicting external references provided via arguments can be handled via an error message.
  • Conflicting external references provided via environment variables will by definition have the value of the last assignment

However, how to resolve conflicts for 2, i.e. external references within the external block of different input YARRRML documents?

@bjdmeest
Copy link
Collaborator

Personal opinion: last one has priority, consistent across all 'inputs', so:

  • -e name=John -e name=Jane --> 'Jane'
  • external references of second yarrrml file (order of CLI parameters) has priority over first yarrrml file
  • .env: last assignment has priority over previous assignments

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

No branches or pull requests

2 participants