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

Implement JSON round-trip and fix specs #1

Open
ronaldtse opened this issue Oct 30, 2024 · 0 comments
Open

Implement JSON round-trip and fix specs #1

ronaldtse opened this issue Oct 30, 2024 · 0 comments

Comments

@ronaldtse
Copy link
Contributor

Due to the "very unconventional" ways of ALI being used in JSON differing from how it works with XML, we needed to implement a Ali::Container class to contain the ALI JSON object.

The usages are rather strange as demonstrated below.

FreeToRead

FreeToRead can be an object or a Boolean.

spec/fixtures/json/spec_example_1.json

{
  "@context": "http://www.niso.org/schemas/ali/1.0.1/jsonld.json",
  "free_to_read": true
}

spec/fixtures/json/spec_example_1.json

{
"@context": "http://www.niso.org/schemas/ali/1.0.1/jsonld.json",
  "free_to_read": {
    "start_date": "2013-02-03",
    "end_date": "2013-10-03"
  }
}

LicenseRef

LicenseRef can be just a URI, one instance, or multiple instances:

spec/fixtures/json/spec_example_3.json

{
  "@context": "http://www.niso.org/schemas/ali/1.0.1/jsonld.json",
  "free_to_read": true,
  "license_ref": "http://creativecommons.org/licenses/by/3.0/"
}

spec/fixtures/json/spec_example_4.json

{
  "@context": "http://www.niso.org/schemas/ali/1.0.1/jsonld.json",
  "free_to_read": true,
  "license_ref": {
    "start_date": "2014-04-04",
    "uri": "http://creativecommons.org/licenses/by/3.0/"
  }
}

spec/fixtures/json/spec_example_6.json

{
  "@context": "http://www.niso.org/schemas/ali/1.0.1/jsonld.json",
  "free_to_read": true,
  "license_ref": [
    {
      "start_date": "2015-04-04",
      "applies_to": "https://doi.org/10.15223/asf-profile",
      "uri": "https://doi.org/10.15223/policy-005"
    },
    {
      "start_date": "2015-04-04",
      "applies_to": "https://doi.org/10.15223/asf-profile",
      "uri": "https://doi.org/10.15223/policy-025"
    },
  ]
}

TODO

  • We need to provide proper JSON specs for FreeToRead and LicenseRef. (right now the JSON specs fail because all the examples are wrapped by a container)
  • Handle the above mentioned cases of "unconventional" usages.
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

1 participant