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

JSON Schema (or similar) definition #34

Open
keithlayne opened this issue Feb 11, 2020 · 5 comments
Open

JSON Schema (or similar) definition #34

keithlayne opened this issue Feb 11, 2020 · 5 comments

Comments

@keithlayne
Copy link

I apologize if this isn't the right place for this question, please redirect me if so.

The current version of the spec mentions JSON, and mediainfo produces JSON output natively with its EBUCore_JSON output. However, I can't find any definition of this format. XSD does not map 1:1 to JSON Schema. Is the JSON format formalized? If so, can it be published in some format alongside the XSD?

I could try to maintain a handcrafted schema, but that doesn't fill me with confidence, and I don't know where/how I could get a library of test files to validate against other than by running mediainfo against a bunch of files, and that seems like a fragile approach anyway. I'd prefer to get the single source of truth from the horse's mouth.

If this resource already exists and I've just missed it, please let me know!

@JPEvain
Copy link
Contributor

JPEvain commented Feb 11, 2020 via email

@keithlayne
Copy link
Author

Thanks for replying so quickly!

I looked through the mediainfo source and it appeared that the JSON output matches the XML very closely. This may be a case where the XSD->JSON schema tooling (there's not much) might be able to succeed with a simple mapping.

I don't think JSON schema is actually standardized (still), but it seems widely used with pretty mature tooling across languages. In my current project I'm targeting TypeScript, which has good tooling for (at least) code generation from JSON Schema.

I did see the use of arrays and was not sure of the semantics there. I guess what I really need to do is to dig into the XSD to answer questions like that. I'm not familiar enough with the spec to know what to expect.

For example, I looked at output of a previous version of mediainfo (not sure which EBUCore version it supported) for a video file, and the structure was much more flat, i.e. no arrays. I guess what's not currently clear at the moment (and probably is answered by the XSD) is whether or not those arrays are intended to represet zero-or-one, zero-or-many, or one-or-many. Hopefully that makes sense.

@JPEvain
Copy link
Contributor

JPEvain commented Feb 12, 2020 via email

@jstarpl
Copy link

jstarpl commented May 30, 2021

@keithlayne Hey, did you progress on the EBUCore JSON schema? I'd also like to use EBUCore in a JSON/TypeScript environment and I'm wondering if there's something existing work to take advantage of.

@keithlayne
Copy link
Author

@jstarpl I am just validating the fields that I depend on. Probably a good candidate for runtime types, e.g. zod/runtypes/io-ts. Supporting the full ebucore format seems like too much work without automation.

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