Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Suggesting namespace annotation #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

petrochenko-pavel-a
Copy link

@petrochenko-pavel-a petrochenko-pavel-a commented Jun 29, 2017

Hi guys, this PR is a result of today raml-dialects meeting.

As we all agree we need an annotation to associate a global identifier with a document. It is very likely that this identifier should be an url, but for now we are only sure that this annotation should exists and agreed about common name for it.

P.S. As for me it seems that we should require that value of this annotation should be a valid url. (we are not sure in this yet, so I am not adding this into PR itself)

P.P.S Another question is what are allowed valid targets for this annotation, as for me it should be any RAML fragment.

At this moment we use this both in AMF and in my research projects, so it would be nice if we will be able to standardise it.

@sichvoge
Copy link
Contributor

Can you remove this iml file, please.

removing intelliJ iml.
@sichvoge
Copy link
Contributor

You don't need a gitkeep file right? Do you think we will add more domain description annotations? If yes, I'd suggest to move them into a dedicated folder domain or dialect. Please also add a README for that folder if we agree, with a description on whats the content of this folder about.

@petrochenko-pavel-a
Copy link
Author

petrochenko-pavel-a commented Jun 30, 2017

Removed .gitkeep.

Do you think we will add more domain description annotations?

At some moment for sure.

However I have a following concern with placing namespace - annotation into domain folder.

This annotation has very simple semantic which may be used without going deep into describing domain. For example simplest use case is that some may just assign some unique namespace for his annotation types), so I am not sure that this annotation should in domain folder.

Personally for me it is a more like a core annotation which should be promoted to be used by any annotation library author to identify his libraries. In other words it is related to domain but I am not sure that we should place it inside of domain folder. So it might be that something like core is a better place for it.

@antoniogarrote what do you think?

@petrochenko-pavel-a
Copy link
Author

@antoniogarrote @sichvoge pinging you

description: |
this annotation type allows you to associate unique identifier with a RAML document.
type: string
(namespace): http://raml.org/vocabularies/annotations/core

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some doubts about the value for the annotation:

  • In general it could be any unique string, but that's difficult to enforce.
  • We could try to specify that it should be a URL, but that mean we are enforcing the idea of RAMLs as linked data. This is not something clear right now. For example, Exchange doesn't share it.
  • It could be a URI, as the (http://raml.org/vocabularies/annotations/core or exchange:group.asset.version)
  • It could be a URI prefix, like (http://raml.org/vocabularies/annotations/core#)

Should we specific about this?
Is there a way of being more specific than just saying type: string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Antonio. We shouldn't use a string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, let's move that under a core directory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the thing in question here actually. If we do not want to use string should we enforce uri's or uri prefixes. I personally would prefer to enforce uri's.

But this actually enforces some naming scheme that might be not optimal for some approaches.
For example if Exhange guys would generate this annotations for their assets, they might probably want to have namespace value looking as java package name.

So I decided to leave it as string for now, and then when we have a decition, we may issue version 2 of this library.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On other side if we all agree that uri's is the way to go let's just define an uri type.

Copy link
Author

@petrochenko-pavel-a petrochenko-pavel-a Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as well as I can guess you are voting for explicitly requiring it to be url. (As for me I am almost 100% sure that it should be urls, but probably would prefer to write this in comment for this version of the library)

Do we have a type uri already or do you need to define it?

I have this type in other library which I am not contributing yet. Do you think that we should include it to this PR?

Regards,
Pavel

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure what you mean. Can you elaborate, please?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure what you mean. Can you elaborate, please?

The global goal of this annotation is to solve identity problem for reusable artefacts in RAML. Solving this goal does not strictly require us to add any restrictions on the identifier
values , we can require it to be an uri or url or just leave it as string. By some reason I have misread you and thought that you are suggesting it to be urls which looks like to restrictive at this stage.

My suggestion was to let it be a string with a comment in the initial version, and then when we gather more feedback, release a next version which will contain stricter restriction.

Only concern that I have agains making it an uri in a first version it that it might affect some theoretical naming schemes that people may want to use.

Regards,
Pavel

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if "making it more restrictive" is the best approach. That would potentially mean that specs that using this annotation might fail. This would be a breaking change. Why are we not making it restrictive now and if use cases come in that need a bit more flexibility, we open it? This way we would not break existing specs.

Copy link
Author

@petrochenko-pavel-a petrochenko-pavel-a Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would potentially mean that specs that using this annotation might fail

Not actually, because specification depends from some fixed version of the library.

Why are we not making it restrictive now and if use cases come in that need a bit more flexibility, we open it?

Already agreed and changed to uri. :-)

@antoniogarrote
Copy link

antoniogarrote commented Jul 14, 2017

@petrochenko-pavel-a I agree this is really core. In fact it should even be part of RAML itself. We are encouraging people to build modules, but they cannot name those modules.

We have problem with identity in RAML that has to be solved before the release of Exchange 2.0

These are all the different ways we are trying to solve the question of how to identify a reusable unit of a RAML spec:

  • Standard RAML 1.0:

The only important thing is the plain label of the re-used annotated domain element (annotation type, type, trait, etc). The document where the element is included is not important, it doesn't provide a namespace.
There's no notion of a 'package' with identity. Users need to deal with name clashes and resolve them on their own.
re-used components are private to users and even projects, not great vision of publicly shared annotations or tools building functionality on them

  • AMF

Namespace is not explicit. The published document (URL) is implicitly the namespace for the elements in the document. Logical namespace and physical HTTP URL are the same thing.
Domain elements in the documents have an identity provided by a URI built based on the base URL of the document and the 'path' within the AST of the document.
In this is very similar to OpenAPI where every element has a proper URI (URL of the base document + JSON pointer) and you can link any element from any other document using $refs.
Expectation of a public registry of re-usable units (Exchange) accessible through HTTP will be available

  • Exchange 2.0

The namespace is explicit but it's stored in project descriptor using Maven (GAV) syntax and only important to resolve dependencies by an external package manager.
Reusable units are possible but only from the point of view of the physical distribution of the files. Tools working with RAML only will not be aware of the namespace introduced by the GAV, reusable units will still be identified by plain string in a flat namespace and names clashes are very likely to happen if reusing takes off in the platform.

  • namespace annotation proposal

Makes the namespace explicit. Provides a stable namespaced identity to every single element of the spec independently of where is located (local file, URL) or how the file was retrieved.

We need to find some agreement around this different approaches, and that should happen before customers start creating lots of re-usable units in Exchange 2.0

@petrochenko-pavel-a
Copy link
Author

petrochenko-pavel-a commented Jul 14, 2017

it should even be part of RAML itself.

At some moment it was... :-)

As well as I understand AMF is fine with namespaces, so as for me what we should do is to try to convince people in exhange to support namespaces in some form, however I do not see any blocker for us here.

@petrochenko-pavel-a
Copy link
Author

Added url and uri types, added requirement for namespace to be an uri

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants