You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Simone Tripodi <si...@gmail.com> on 2018/09/14 16:20:35 UTC
[DISCUSS] reducing the api-regions extension verbosity
Hi all,
During the last days I've been working with the api-regions extension and I
think we can improve, even if a little, the extension verbosity.
What we currently have is something where fields are explicitly identified
via the "name" and "exports" fields:
"api-regions:JSON|false": [
{
"name": "global",
"exports": [
"org.osgi.util.function"
]
},
{
"name": "asf",
"exports": [
"org.osgi.util.function"
]
}
]
while they can be implicit, reducing the syntax where each key identifies
directly the region "name" and the related string array values identify the
"exports":
"api-regions:JSON|false": {
"global": [
"org.osgi.util.function"
],
"asf": [
"org.osgi.util.function"
]
}
specifying the main array is not needed anymore.
Moreover, in order to implement the "export all" behaviour, we could use
wildcards that users are already used to, i.e.:
"api-regions:JSON|false": {
"global": [
"*"
],
"asf": [
"org.osgi.util.function"
]
}
What do you think?
Many thanks in advance, all the best!
~Simo
http://people.apache.org/~simonetripodi/
http://www.99soft.org/
Re: [DISCUSS] reducing the api-regions extension verbosity
Posted by Carsten Ziegeler <cz...@apache.org>.
Hi
Simone Tripodi wrote
> Hi Carsten!
> thanks for the feedbacks!
>
> OK for the clarification about the order, I didn't catch that the sequence
> regions matters.
>
> I was too vague about the wildcard, I took the idea from [1], where it is
> stated
>
> "If the api-regions extension is missing or the api-regions information
> is missing, it is assumed that all packages are exported to the "global"
> region and all packages in the global region are visible to the feature."
>
> The implicitly nature of the "export all" could be more error prone that
> a consciously taken decision of exporting everything.
>
but it's easy to check whether a region is defined at all, so that error
can be catched by tooling immediately
Regards
Carsten
> All the best!
> ~Simo
>
> [1]
> https://github.com/apache/sling-org-apache-sling-feature/blob/master/apicontroller.md
>
> -Simone Tripodi (aka 3pod)
>
> The nerd guy@CrossFit Albalonga
> Via Quarto Negroni, 24
> 00040 Ariccia (Roma)
> Italy
>
> http://www.crossfitalbalonga.com/
> https://www.facebook.com/CrossfitAlbalonga/
>
>
> On Fri, Sep 14, 2018 at 6:56 PM Carsten Ziegeler <cz...@apache.org>
> wrote:
>
>> Hi Simo
>>
>> thanks for your suggestions.
>>
>> Unfortunately the array is needed as the regions have an order, a later
>> region adds to the preceding region. A map in JSON has no order.
>>
>> The point of the api controller is to avoid accidental exports of new
>> packages. Therefore if new api is added it should be a conscious
>> decision to export this to others. Therefore we don't want to support
>> wildcards as this would be against this goal.
>>
>> In general, if you've written the section once, you rarely need to touch
>> it again. And for the first time you might want to generate it with a
>> script or something
>>
>> Carsten
>>
>>
>> Simone Tripodi wrote
>>> Hi all,
>>> During the last days I've been working with the api-regions extension
>> and I
>>> think we can improve, even if a little, the extension verbosity.
>>>
>>> What we currently have is something where fields are explicitly
>> identified
>>> via the "name" and "exports" fields:
>>>
>>> "api-regions:JSON|false": [
>>> {
>>> "name": "global",
>>> "exports": [
>>> "org.osgi.util.function"
>>> ]
>>> },
>>> {
>>> "name": "asf",
>>> "exports": [
>>> "org.osgi.util.function"
>>> ]
>>> }
>>> ]
>>>
>>> while they can be implicit, reducing the syntax where each key identifies
>>> directly the region "name" and the related string array values identify
>> the
>>> "exports":
>>>
>>> "api-regions:JSON|false": {
>>> "global": [
>>> "org.osgi.util.function"
>>> ],
>>> "asf": [
>>> "org.osgi.util.function"
>>> ]
>>> }
>>>
>>> specifying the main array is not needed anymore.
>>>
>>> Moreover, in order to implement the "export all" behaviour, we could use
>>> wildcards that users are already used to, i.e.:
>>>
>>> "api-regions:JSON|false": {
>>> "global": [
>>> "*"
>>> ],
>>> "asf": [
>>> "org.osgi.util.function"
>>> ]
>>> }
>>>
>>> What do you think?
>>> Many thanks in advance, all the best!
>>> ~Simo
>>>
>>> http://people.apache.org/~simonetripodi/
>>> http://www.99soft.org/
>>>
>> --
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
>>
>
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org
Re: [DISCUSS] reducing the api-regions extension verbosity
Posted by Simone Tripodi <3p...@crossfitalbalonga.com>.
Hi Carsten!
thanks for the feedbacks!
OK for the clarification about the order, I didn't catch that the sequence
regions matters.
I was too vague about the wildcard, I took the idea from [1], where it is
stated
"If the api-regions extension is missing or the api-regions information
is missing, it is assumed that all packages are exported to the "global"
region and all packages in the global region are visible to the feature."
The implicitly nature of the "export all" could be more error prone that
a consciously taken decision of exporting everything.
All the best!
~Simo
[1]
https://github.com/apache/sling-org-apache-sling-feature/blob/master/apicontroller.md
-Simone Tripodi (aka 3pod)
The nerd guy@CrossFit Albalonga
Via Quarto Negroni, 24
00040 Ariccia (Roma)
Italy
http://www.crossfitalbalonga.com/
https://www.facebook.com/CrossfitAlbalonga/
On Fri, Sep 14, 2018 at 6:56 PM Carsten Ziegeler <cz...@apache.org>
wrote:
> Hi Simo
>
> thanks for your suggestions.
>
> Unfortunately the array is needed as the regions have an order, a later
> region adds to the preceding region. A map in JSON has no order.
>
> The point of the api controller is to avoid accidental exports of new
> packages. Therefore if new api is added it should be a conscious
> decision to export this to others. Therefore we don't want to support
> wildcards as this would be against this goal.
>
> In general, if you've written the section once, you rarely need to touch
> it again. And for the first time you might want to generate it with a
> script or something
>
> Carsten
>
>
> Simone Tripodi wrote
> > Hi all,
> > During the last days I've been working with the api-regions extension
> and I
> > think we can improve, even if a little, the extension verbosity.
> >
> > What we currently have is something where fields are explicitly
> identified
> > via the "name" and "exports" fields:
> >
> > "api-regions:JSON|false": [
> > {
> > "name": "global",
> > "exports": [
> > "org.osgi.util.function"
> > ]
> > },
> > {
> > "name": "asf",
> > "exports": [
> > "org.osgi.util.function"
> > ]
> > }
> > ]
> >
> > while they can be implicit, reducing the syntax where each key identifies
> > directly the region "name" and the related string array values identify
> the
> > "exports":
> >
> > "api-regions:JSON|false": {
> > "global": [
> > "org.osgi.util.function"
> > ],
> > "asf": [
> > "org.osgi.util.function"
> > ]
> > }
> >
> > specifying the main array is not needed anymore.
> >
> > Moreover, in order to implement the "export all" behaviour, we could use
> > wildcards that users are already used to, i.e.:
> >
> > "api-regions:JSON|false": {
> > "global": [
> > "*"
> > ],
> > "asf": [
> > "org.osgi.util.function"
> > ]
> > }
> >
> > What do you think?
> > Many thanks in advance, all the best!
> > ~Simo
> >
> > http://people.apache.org/~simonetripodi/
> > http://www.99soft.org/
> >
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>
Re: [DISCUSS] reducing the api-regions extension verbosity
Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Simo
thanks for your suggestions.
Unfortunately the array is needed as the regions have an order, a later
region adds to the preceding region. A map in JSON has no order.
The point of the api controller is to avoid accidental exports of new
packages. Therefore if new api is added it should be a conscious
decision to export this to others. Therefore we don't want to support
wildcards as this would be against this goal.
In general, if you've written the section once, you rarely need to touch
it again. And for the first time you might want to generate it with a
script or something
Carsten
Simone Tripodi wrote
> Hi all,
> During the last days I've been working with the api-regions extension and I
> think we can improve, even if a little, the extension verbosity.
>
> What we currently have is something where fields are explicitly identified
> via the "name" and "exports" fields:
>
> "api-regions:JSON|false": [
> {
> "name": "global",
> "exports": [
> "org.osgi.util.function"
> ]
> },
> {
> "name": "asf",
> "exports": [
> "org.osgi.util.function"
> ]
> }
> ]
>
> while they can be implicit, reducing the syntax where each key identifies
> directly the region "name" and the related string array values identify the
> "exports":
>
> "api-regions:JSON|false": {
> "global": [
> "org.osgi.util.function"
> ],
> "asf": [
> "org.osgi.util.function"
> ]
> }
>
> specifying the main array is not needed anymore.
>
> Moreover, in order to implement the "export all" behaviour, we could use
> wildcards that users are already used to, i.e.:
>
> "api-regions:JSON|false": {
> "global": [
> "*"
> ],
> "asf": [
> "org.osgi.util.function"
> ]
> }
>
> What do you think?
> Many thanks in advance, all the best!
> ~Simo
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org