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

Specification names can clash with field names #20

Open
peterdesmet opened this issue May 18, 2016 · 4 comments
Open

Specification names can clash with field names #20

peterdesmet opened this issue May 18, 2016 · 4 comments
Labels
Milestone

Comments

@peterdesmet
Copy link
Member

peterdesmet commented May 18, 2016

The way if statements are constructed, we run into trouble with reserved words for tests, like type (which is a test and DwC term). E.g.:

# eventID should be 8 character integer when type = Event
eventID:
  if:
    - type:
        allowed: Event
      type: integer
      numberformat: '8.'
    - type:
        # other test

Gets translated as:

{
  "eventID": {
    "if": [
      {
        "type": "integer", 
        "numberformat": "8."
      }, 
      {
        "type": null
      }
    ]
  }
}
@peterdesmet
Copy link
Member Author

Updated example to a more logical one.

@stijnvanhoey
Copy link
Collaborator

This problem is similar to issue #17, resulting in similar keys, which can not be handled by a dictionary.

@peterdesmet
Copy link
Member Author

Potential solutions.

term and then

  • 👍 if does not require a -
  • 👎 Odd that then is not on the same level as if.
  • 👎 then cannot be used as a term name, as it is on the same level where term names are expected
eventID:
  if:
    - type:
        allowed: Event
      then: # New syntax
        type: integer
        numberformat: '8.'
    - type:
        # other test

term and term

  • 👍 No reserved words
  • 👎 Term (eventID) is repeated
  • 👎 In interpreted format it gets confusing what term is the condition (type) and which one has expectations (eventID) as they can be ordered differently
  • 👎 if need to be repeated
  • 👎 if needs -
eventID:
  - if:
      type:
        allowed: Event
      eventID: # Gets repeated
        type: integer
        numberformat: '8.'
  - if:
     # other test

if and then

  • 👍 Readable
  • 👍 then is not reserved
  • 👎 if needs to be repeated
  • 👎 if really needs -
  • 👎 Can be confusing that then cannot have a -
eventID:
  - if:
      type:
        allowed: Event
    then: # new syntax
      type: integer
      numberformat: '8.'
  - if: # repeated
     type:
        # other test

expect and when

Very similar to above, but slightly improved

  • 👍 All tests have - and have thus a defined order
  • 👍 Readable
  • 👍 when is not reserved
  • 👎 expect needs to be repeated
eventID:
- empty: true
- expect:
    type: integer 
    numberformat: '8.'
  when:
    type:
      allowed: Event
- expect:
    # other test

@peterdesmet
Copy link
Member Author

We'll no longer use type #24, but the problem with reserved keywords remains

@peterdesmet peterdesmet changed the title Type is reserved Specification names can clash with field names Jan 5, 2017
@peterdesmet peterdesmet added this to the Release 1.0 milestone Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants