opds-community / drafts

Contains all the current drafts for the OPDS specifications
36 stars 10 forks source link

JSON Schema - metadata.title/subtitle, harmonization with ReadiumWebPubManifest? #24

Open danielweck opened 5 years ago

danielweck commented 5 years ago

The main difference (besides the looser type definition) is that OPDS subtitles allow arrays:

https://github.com/opds-community/drafts/blob/4d82fb9a64f35a174a5f205c23ba623ec010d5ec/schema/feed-metadata.schema.json#L22

    "subtitle": {
      "type": [
        "string",
        "array",
        "object"
      ]
},

versus:

https://github.com/readium/webpub-manifest/blob/0976680e25852b8a4c4802a052ba750ab3e89284/schema/metadata.schema.json#L33

    "subtitle": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "description": "The language in a language map must be a valid BCP 47 tag.",
          "type": "object",
          "patternProperties": {
            "^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))$": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "minProperties": 1
        }
      ]
},
danielweck commented 5 years ago

Exact same issue with title:

https://github.com/opds-community/drafts/blob/4d82fb9a64f35a174a5f205c23ba623ec010d5ec/schema/feed-metadata.schema.json#L15

https://github.com/readium/webpub-manifest/blob/0976680e25852b8a4c4802a052ba750ab3e89284/schema/metadata.schema.json#L15

danielweck commented 5 years ago

Related issue: https://github.com/opds-community/drafts/issues/25

HadrienGardeur commented 5 years ago

They're a little undefined in the current draft as well, so their current expression in the JSON Schema is consistent with that.

It's not clear if we need all that complexity for the metadata of a feed, or if we need a subtitle either.

acuna-public commented 4 years ago

It's so sad that new draft don't supports Readium manifest which is more user-friendly for develop it :(

HadrienGardeur commented 4 years ago

@acuna-public since OPDS 2.0 is very much based on Readium, it's not clear what you mean by that.

acuna-public commented 4 years ago

@HadrienGardeur I've created an issue here. Please compare the draft and docs, for example links section became as

"links": [
    {"rel": "self", "href": "http://example.com/opds", "type": "application/opds+json"}
  ]

in the docs, but at the draft which link present at the end of the docs as an example it became

"links": {
    "description": "Feed-level links such as search or pagination",
    "type": "array",
    "items": {
         "$ref": "https://readium.org/webpub-manifest/schema/link.schema.json"
    },
    "uniqueItems": true,
    "contains": {
    "properties": {
            "rel": {
                "anyOf": [
                    {
                        "type": "string",
                        "const": "self"
                    },
                    {
                        "type": "array",
                        "contains": {
                            "const": "self"
                        }
                    }
                ]
            }
        },
        "required": [
            "rel"
        ]
    }
},

Or I've missed something?

HadrienGardeur commented 4 years ago

Basically this schema means:

Could you explain why this is problematic?

acuna-public commented 4 years ago

I believe that it means anywhere, but I don't see it at the docs. I think you don't want to users asked you about any of the item so you create the docs, isn't it? :) So I've implemented any what described in docs only for cosily support it in future.