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

astool tool improvement idea: @context alias normalization #96

Open
cjslep opened this issue Jan 26, 2019 · 3 comments
Open

astool tool improvement idea: @context alias normalization #96

cjslep opened this issue Jan 26, 2019 · 3 comments
Labels
feature request New request for novel functionality

Comments

@cjslep
Copy link
Member

cjslep commented Jan 26, 2019

It remains to be seen how the community of not-really-linked-data implementations (which includes go-fed right now) will handle ActivityPub extensions.

For example, will types be like:

{
  "@context": [
    "https://example.com/issues"
  ],
  "type": "Issue"
}

or

{
  "@context": {
    "ex": "https://example.com/issues"
  },
  "type": "ex:Issue"
}

Right now the behavior is: We set the alias to a literal known at code generation time. We don't expect others to use aliases. That's it.

So one idea is to code-generate the stuff that will be able to handle normalizing any aliases already in a payload (when adding new things), or setting it to a code-generation-time known default (if no alias has previously been used).

It's possible an entirely different solution is needed.

This is also a wider ActivityPub community convention question, one we haven't faced (yet).

@cjslep cjslep added the feature request New request for novel functionality label Jan 26, 2019
@ppwfx
Copy link
Contributor

ppwfx commented Jan 30, 2019

Hey cj,

I worked on this half a year ago. I used github.com/piprate/json-gold/ld for it. It returns a list of normalized triples, that can map onto your structs.

At point I got really pissed about json-ld tho, when I discovered that the following is valid json-ld.

{
  "@context": {
    "ex": "https://example.com/issues"
  },
  "type": "ex:Issue",
  "type": "Issue"
}

Meaning, in order to become fully json-ld compliant each struct field needs to be a slice.

@ppwfx
Copy link
Contributor

ppwfx commented Jan 30, 2019

It's https://github.com/21stio/go-rdfgen, if you want to have a look

@cjslep
Copy link
Member Author

cjslep commented Jul 5, 2020

Thanks @ppwfx!

Also, note to self, this issue at code-generation time is the equivalent to what I thought I could do at runtime in issue #113 (which it can't, so that one is closed).

@cjslep cjslep changed the title v1 tool improvement idea: @context alias normalization astool tool improvement idea: @context alias normalization Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New request for novel functionality
Projects
None yet
Development

No branches or pull requests

2 participants