RE: Resource Type mandatory or optional?

2020-01-10 Thread Stefan Seifert
egeler [mailto:cziege...@apache.org] >Sent: Thursday, January 9, 2020 10:45 PM >To: dev@sling.apache.org >Subject: Re: Resource Type mandatory or optional? > >I looked at some of our provider implementations and all of them make >sure to return a default resource type; so I think we're safe

Re: Resource Type mandatory or optional?

2020-01-09 Thread Carsten Ziegeler
I looked at some of our provider implementations and all of them make sure to return a default resource type; so I think we're safe here. The only place where we potentially could handle this is inside the resource resolver implementation after a resource is returned from a provider. If the

RE: Resource Type mandatory or optional?

2020-01-09 Thread Stefan Seifert
to sum up the opinions: 1. Sling API should always return a resource type, even if it's a fallback one 2. setting a sling:resourceType property is optional, if it's not set a fallback resource type is returned 3. the JCR resource provider always uses the JCR primrary type as fallback -> open

Re: Resource Type mandatory or optional?

2020-01-09 Thread Jason E Bailey
I believe always delivering a resource type is also the right thing to do. It shouldn't be up to the provider of the resource to dictate how the resource is to be rendered. Rather it's up to the Sling implementation. By stating it must return a resource type even if it's the default allows for

Re: Resource Type mandatory or optional?

2020-01-09 Thread Daniel Klco
Agreed with Carsten. Reading the docs and considering how people use the API, all resources should have types, the potential for breaking changes in downstream code if Resource Types are allowed to be nullable is significant. On Thu, Jan 9, 2020 at 8:37 AM Carsten Ziegeler wrote: > Thanks for

Re: Resource Type mandatory or optional?

2020-01-09 Thread Carsten Ziegeler
Thanks for the pointer, Konrad: that page clearly states: "Each resource has a resource type which is used by the Servlet and Script resolver to find the appropriate Servlet or Script to handle the request for the Resource." The javadocs are not very precise, but they do not mention that it

Re: Resource Type mandatory or optional?

2020-01-09 Thread Konrad Windszus
One more clarification: Via the implicit resource super type "sling/servlet/default" technically each resource has a resource type which is used for rendering resources. > On 9. Jan 2020, at 14:09, Konrad Windszus wrote: > > I tend to agree with the statement that the resource type should be

Re: Resource Type mandatory or optional?

2020-01-09 Thread Konrad Windszus
I tend to agree with the statement that the resource type should be optional. Not every resource should be rendered and having no resource type set on those resources feels natural to me. Enforcing a non-null resource type for every resource is more complicated as each resource provider must be