Add support for multiple types

Aperta
#60 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, json
Ambito
backend, tooling

Direzione di ricerca

Start by locating the validator code that checks JSON-LD @type and reports “Wrong document type”; the issue does not name a file or test. Determine how it handles multiple types and whether fields from both types can be used. Done means the validator accepts a valid record with both SoftwareSourceCode and SoftwareApplication types; the issue provides no test entry point.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

I'm working to convert a full schema.org json-ld record for software into a codemeta and am having problems with the codemeta validator. The json validates on https://validator.schema.org/. Pasting the first few lines

{
    "@context": {
      "@vocab": "https://schema.org/",
      "prov": "http://www.w3.org/ns/prov#",
      "sosa": "https://w3c.github.io/sdw-sosa-ssn/ssn/#SOSA"
    },
    "@id": "https://doi.org/10.5281/zenodo.591887",
    "@type": ["SoftwareSourceCode", "SoftwareApplication"]
}

into the codemeta validator gives the error

Wrong document type: must be "SoftwareSourceCode"/"SoftwareApplication", not ["SoftwareSourceCode","SoftwareApplication"]

This error makes no sense to me because SoftwareApplication is not lower on the tree than SoftwareSourceCode. But when I change the line to be as instructed anyway,

{
    "@context": {
      "@vocab": "https://schema.org/",
      "prov": "http://www.w3.org/ns/prov#",
      "sosa": "https://w3c.github.io/sdw-sosa-ssn/ssn/#SOSA"
    },
    "@id": "https://doi.org/10.5281/zenodo.591887",
    "@type": "SoftwareSourceCode"/"SoftwareApplication"
}

I still get the error

Could not read codemeta document because it is not valid JSON (SyntaxError: Expected ',' or '}' after property value in JSON at position 256 (line 8 column 34)). Check for missing or extra quote, colon, or bracket characters.

Any ideas? Can the codemeta validator be updated to accept multiple types so that the fields from both can be used?
If codemeta is aligned more with schema.org, we could lean more on the schema.org validator instead of making a completely new one. Then, all we would need to do is check the schema.org validator for errors, and if it passes, then just check that the terms codemeta has selected are used (e.g. author instead of creator).

Lingua principale
JavaScript
Stelle
23
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codemeta/codemeta-generator

Tutte le issue di codemeta/codemeta-generator

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.