json-ld / yaml-ld

CG specification for YAML-LD and UCR
https://json-ld.github.io/yaml-ld/spec
Other
22 stars 8 forks source link

YAML presentation ("cosmetic") controls #42

Closed VladimirAlexiev closed 2 years ago

VladimirAlexiev commented 2 years ago

As an information architect. When serializing YAML. I want control over all YAML presentation ("cosmetic") features. So that I can obtain a YAML representation that is most readable and usable for my case.

What "cosmetic" features do I mean:

How to list all controllable features systematically?

Here are the options of some serializers:

Most of these are for Perl, could you please add links to serializers in other languages?

Maybe we should also turn to linters. https://megalinter.github.io/latest/descriptors/yaml/ can use 3 YAML linters:

Finally, this specifically aims to fix presentation, but currently has a somewhat limited set of options

ioggstream commented 2 years ago

@VladimirAlexiev do you think we should define a recommended serialization for YAML-LD, or just to define a linter configuration for this repo (:+1: ) ?

I think YAML serialization configuration should be delegated to YAML and implementations, because they will improve over time.

An interesting caveat is instead the one related to multiple documents in the same stream, e.g.

---
a: 1
...
---
a: 2
...
VladimirAlexiev commented 2 years ago

@ioggstream We should definitely use a consistent style of all our examples, so we need a linter configuration for this repo.

serialization configuration should be delegated to YAML and implementations,

Maybe. However:

gkellogg commented 2 years ago

I think adopting a consistent style for our examples is important, but 👎 on putting anything about a required style in the spec itself. In any case, that should be a YAML concern, not a YAML-LD concern.

OR13 commented 2 years ago

I'm struggling to grok exactly what is proposed here, but I interpret this as a call for supporting the "non round trip-able to JSON features"... which I am in favor of... just we need to start using unique names for both cases.

I suggest we just start considering them different media types...

application/ld+yaml vs application/ld+json+yaml.

One is JSON-LD round trip-able... the other is not.

application/ld+yaml should allow for cosmetic features... +1 to the proposal.

ioggstream commented 2 years ago

@OR13 I will vote after the testcases are written :) These days I'm struggling even with very simple issues like extending fragment identification to YAML streams https://github.com/ietf-wg-httpapi/mediatypes/pull/55 since I just discovered that future versions of YAML might consider that docs in a stream are not independent :P

VladimirAlexiev commented 2 years ago

I agree with @gkellogg and @ioggstream that the spec shouldn't claim any required style. But it can point to a linter configuration as a useful resource.

gkellogg commented 2 years ago

I agree with @gkellogg and @ioggstream that the spec shouldn't claim any required style. But it can point to a linter configuration as a useful resource.

Any such mechanism should probably work for JSON as well. But, I'm not aware of any such convention, or how we might signal that, other than through API extensions.

gkellogg commented 2 years ago

Discussed at TPAC F2F and resolved to close as out-of-scope.

VladimirAlexiev commented 2 years ago

@gkellogg

such mechanism should probably work for JSON as well

YAML has a lot more formatting options, eg to limit display line length of strings. In JSON you can only vary the indentation and newlines.