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

Allowing type duplications is not documented in the spec #716

Open
tom-tan opened this issue Jul 10, 2023 · 3 comments
Open

Allowing type duplications is not documented in the spec #716

tom-tan opened this issue Jul 10, 2023 · 3 comments

Comments

@tom-tan
Copy link
Member

tom-tan commented Jul 10, 2023

The spec of Apache Avro says:

Unions may not contain more than one schema with the same type, except for the named types record, fixed and enum.

As described in the spec of SALAD, SALAD is based on Apache Avro.

Salad builds on JSON-LD and the Apache Avro data serialization system

Also, there are few descriptions of union types in the spec of SALAD.

Therefore, we expect that union types behave as same as Apache Avro. That is, SALAD does not allow type duplications in union types.
However, schema-salad-tool allows type duplications.

For example:

$graph:
- name: Foo
  type: record
  fields:
    - name: field1
      type: [string, string]
$ schema-salad-tool schema.yml 
/home/vscode/.local/bin/schema-salad-tool Current version: 8.4.20230606143604
Schema 'schema.yml' is valid

Is it an intended behavior?
If intended, it would be nice if it is clarified in the spec of SALAD.

@tetron
Copy link
Member

tetron commented Jul 10, 2023

Allowing duplicated types is not specifically intended behavior, but nothing in the current code specifically checks for uniqueness, so it isn't disallowed either. It has a minimal impact on correctness. If we want to explicitly disallow it, we can.

@mr-c
Copy link
Member

mr-c commented Jul 10, 2023

I'm happy to accept a PR to formally allow type duplicates in union types.

@tom-tan
Copy link
Member Author

tom-tan commented Jul 11, 2023

OK, I will send a request to clarify it.

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

3 participants