You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by "Gary D. Gregory" <gg...@apache.org> on 2025/11/12 13:40:39 UTC
@Path validation is broken in git master or semantics have changed
Hi James and all,
Using the latest git master, I am getting:
Caused by: org.apache.juneau.ContextRuntimeException: Schema specification errors:
Cannot specify a default value on a required value.
at org.apache.juneau.httppart.HttpPartSchema.<init>(HttpPartSchema.java:3829)
at org.apache.juneau.httppart.HttpPartSchema$Builder.build(HttpPartSchema.java:401)
at org.apache.juneau.httppart.HttpPartSchema.create(HttpPartSchema.java:3158)
at org.apache.juneau.rest.arg.PathArg.<init>(PathArg.java:177)
at org.apache.juneau.rest.arg.PathArg.create(PathArg.java:68)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.apache.juneau.common.reflect.MethodInfo.invoke(MethodInfo.java:534)
at org.apache.juneau.cp.BeanCreator.run(BeanCreator.java:295)
at org.apache.juneau.rest.Res
I think something's changed since 9.1.0, the following worked before:
@RestPut(path = "/logger/{logger}/{level}", summary = "Sets the log level for a named logger.", description = "Sets the log level for a named logger (none = root).")
public void setLogLevel(
@Path(name = "logger", def = "") final String loggerName,
@Path(name = "level", def = "INFO") final String levelName) {
...
}
The stack trace errors out on "level". It doesn't matter if I use: @Path(name = "logger", def = "root")
Adding schema = @Schema(required = false) to @Path for "level" doesn't help, even if I put it as the 1st attribute in the @Path.
My only remedy is to use:
@Path(name = "level") final String levelName /* NO DEFAULT "def" ALLOWED! */
Any ideas?
Thank you,
Gary
Re: @Path validation is broken in git master or semantics have changed
Posted by Gary Gregory <ga...@gmail.com>.
On Thu, Nov 13, 2025 at 9:33 AM Gary Gregory <ga...@gmail.com> wrote:
>
> Thank you James! Ill test my use case today and let you know.
Looks good! Thank you again for your prompt support :)
Gary
>
> Gary
>
> On Thu, Nov 13, 2025, 09:26 James Bognar <ja...@apache.org> wrote:
>>
>> Not sure how it worked before, but it should be fixed now. I've added a unit test to cover this scenario.
>>
>> On Wed, Nov 12, 2025 at 8:42 AM James Bognar <ja...@apache.org> wrote:
>>>
>>> Uh oh. That's unintentional. I'll take a look.
>>>
>>> On Wed, Nov 12, 2025 at 8:40 AM Gary D. Gregory <gg...@apache.org> wrote:
>>>>
>>>> Hi James and all,
>>>>
>>>> Using the latest git master, I am getting:
>>>>
>>>> Caused by: org.apache.juneau.ContextRuntimeException: Schema specification errors:
>>>> Cannot specify a default value on a required value.
>>>> at org.apache.juneau.httppart.HttpPartSchema.<init>(HttpPartSchema.java:3829)
>>>> at org.apache.juneau.httppart.HttpPartSchema$Builder.build(HttpPartSchema.java:401)
>>>> at org.apache.juneau.httppart.HttpPartSchema.create(HttpPartSchema.java:3158)
>>>> at org.apache.juneau.rest.arg.PathArg.<init>(PathArg.java:177)
>>>> at org.apache.juneau.rest.arg.PathArg.create(PathArg.java:68)
>>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>>>> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>>>> at org.apache.juneau.common.reflect.MethodInfo.invoke(MethodInfo.java:534)
>>>> at org.apache.juneau.cp.BeanCreator.run(BeanCreator.java:295)
>>>> at org.apache.juneau.rest.Res
>>>>
>>>> I think something's changed since 9.1.0, the following worked before:
>>>>
>>>> @RestPut(path = "/logger/{logger}/{level}", summary = "Sets the log level for a named logger.", description = "Sets the log level for a named logger (none = root).")
>>>> public void setLogLevel(
>>>> @Path(name = "logger", def = "") final String loggerName,
>>>> @Path(name = "level", def = "INFO") final String levelName) {
>>>> ...
>>>> }
>>>>
>>>> The stack trace errors out on "level". It doesn't matter if I use: @Path(name = "logger", def = "root")
>>>>
>>>> Adding schema = @Schema(required = false) to @Path for "level" doesn't help, even if I put it as the 1st attribute in the @Path.
>>>>
>>>> My only remedy is to use:
>>>>
>>>> @Path(name = "level") final String levelName /* NO DEFAULT "def" ALLOWED! */
>>>>
>>>> Any ideas?
>>>>
>>>> Thank you,
>>>> Gary
>>>>
>>>>
Re: @Path validation is broken in git master or semantics have changed
Posted by Gary Gregory <ga...@gmail.com>.
Thank you James! Ill test my use case today and let you know.
Gary
On Thu, Nov 13, 2025, 09:26 James Bognar <ja...@apache.org> wrote:
> Not sure how it worked before, but it should be fixed now. I've added a
> unit test to cover this scenario.
>
> On Wed, Nov 12, 2025 at 8:42 AM James Bognar <ja...@apache.org>
> wrote:
>
>> Uh oh. That's unintentional. I'll take a look.
>>
>> On Wed, Nov 12, 2025 at 8:40 AM Gary D. Gregory <gg...@apache.org>
>> wrote:
>>
>>> Hi James and all,
>>>
>>> Using the latest git master, I am getting:
>>>
>>> Caused by: org.apache.juneau.ContextRuntimeException: Schema
>>> specification errors:
>>> Cannot specify a default value on a required value.
>>> at
>>> org.apache.juneau.httppart.HttpPartSchema.<init>(HttpPartSchema.java:3829)
>>> at
>>> org.apache.juneau.httppart.HttpPartSchema$Builder.build(HttpPartSchema.java:401)
>>> at
>>> org.apache.juneau.httppart.HttpPartSchema.create(HttpPartSchema.java:3158)
>>> at org.apache.juneau.rest.arg.PathArg.<init>(PathArg.java:177)
>>> at org.apache.juneau.rest.arg.PathArg.create(PathArg.java:68)
>>> at
>>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>> at
>>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>>> at
>>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>>> at
>>> org.apache.juneau.common.reflect.MethodInfo.invoke(MethodInfo.java:534)
>>> at org.apache.juneau.cp.BeanCreator.run(BeanCreator.java:295)
>>> at org.apache.juneau.rest.Res
>>>
>>> I think something's changed since 9.1.0, the following worked before:
>>>
>>> @RestPut(path = "/logger/{logger}/{level}", summary = "Sets the log
>>> level for a named logger.", description = "Sets the log level for a named
>>> logger (none = root).")
>>> public void setLogLevel(
>>> @Path(name = "logger", def = "") final String loggerName,
>>> @Path(name = "level", def = "INFO") final String levelName) {
>>> ...
>>> }
>>>
>>> The stack trace errors out on "level". It doesn't matter if I use:
>>> @Path(name = "logger", def = "root")
>>>
>>> Adding schema = @Schema(required = false) to @Path for "level" doesn't
>>> help, even if I put it as the 1st attribute in the @Path.
>>>
>>> My only remedy is to use:
>>>
>>> @Path(name = "level") final String levelName /* NO DEFAULT "def"
>>> ALLOWED! */
>>>
>>> Any ideas?
>>>
>>> Thank you,
>>> Gary
>>>
>>>
>>>
Re: @Path validation is broken in git master or semantics have changed
Posted by James Bognar <ja...@apache.org>.
Not sure how it worked before, but it should be fixed now. I've added a
unit test to cover this scenario.
On Wed, Nov 12, 2025 at 8:42 AM James Bognar <ja...@apache.org> wrote:
> Uh oh. That's unintentional. I'll take a look.
>
> On Wed, Nov 12, 2025 at 8:40 AM Gary D. Gregory <gg...@apache.org>
> wrote:
>
>> Hi James and all,
>>
>> Using the latest git master, I am getting:
>>
>> Caused by: org.apache.juneau.ContextRuntimeException: Schema
>> specification errors:
>> Cannot specify a default value on a required value.
>> at
>> org.apache.juneau.httppart.HttpPartSchema.<init>(HttpPartSchema.java:3829)
>> at
>> org.apache.juneau.httppart.HttpPartSchema$Builder.build(HttpPartSchema.java:401)
>> at
>> org.apache.juneau.httppart.HttpPartSchema.create(HttpPartSchema.java:3158)
>> at org.apache.juneau.rest.arg.PathArg.<init>(PathArg.java:177)
>> at org.apache.juneau.rest.arg.PathArg.create(PathArg.java:68)
>> at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>> at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>> at
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>> at
>> org.apache.juneau.common.reflect.MethodInfo.invoke(MethodInfo.java:534)
>> at org.apache.juneau.cp.BeanCreator.run(BeanCreator.java:295)
>> at org.apache.juneau.rest.Res
>>
>> I think something's changed since 9.1.0, the following worked before:
>>
>> @RestPut(path = "/logger/{logger}/{level}", summary = "Sets the log
>> level for a named logger.", description = "Sets the log level for a named
>> logger (none = root).")
>> public void setLogLevel(
>> @Path(name = "logger", def = "") final String loggerName,
>> @Path(name = "level", def = "INFO") final String levelName) {
>> ...
>> }
>>
>> The stack trace errors out on "level". It doesn't matter if I use:
>> @Path(name = "logger", def = "root")
>>
>> Adding schema = @Schema(required = false) to @Path for "level" doesn't
>> help, even if I put it as the 1st attribute in the @Path.
>>
>> My only remedy is to use:
>>
>> @Path(name = "level") final String levelName /* NO DEFAULT "def" ALLOWED!
>> */
>>
>> Any ideas?
>>
>> Thank you,
>> Gary
>>
>>
>>
Re: @Path validation is broken in git master or semantics have changed
Posted by James Bognar <ja...@apache.org>.
Uh oh. That's unintentional. I'll take a look.
On Wed, Nov 12, 2025 at 8:40 AM Gary D. Gregory <gg...@apache.org> wrote:
> Hi James and all,
>
> Using the latest git master, I am getting:
>
> Caused by: org.apache.juneau.ContextRuntimeException: Schema specification
> errors:
> Cannot specify a default value on a required value.
> at
> org.apache.juneau.httppart.HttpPartSchema.<init>(HttpPartSchema.java:3829)
> at
> org.apache.juneau.httppart.HttpPartSchema$Builder.build(HttpPartSchema.java:401)
> at
> org.apache.juneau.httppart.HttpPartSchema.create(HttpPartSchema.java:3158)
> at org.apache.juneau.rest.arg.PathArg.<init>(PathArg.java:177)
> at org.apache.juneau.rest.arg.PathArg.create(PathArg.java:68)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:569)
> at
> org.apache.juneau.common.reflect.MethodInfo.invoke(MethodInfo.java:534)
> at org.apache.juneau.cp.BeanCreator.run(BeanCreator.java:295)
> at org.apache.juneau.rest.Res
>
> I think something's changed since 9.1.0, the following worked before:
>
> @RestPut(path = "/logger/{logger}/{level}", summary = "Sets the log
> level for a named logger.", description = "Sets the log level for a named
> logger (none = root).")
> public void setLogLevel(
> @Path(name = "logger", def = "") final String loggerName,
> @Path(name = "level", def = "INFO") final String levelName) {
> ...
> }
>
> The stack trace errors out on "level". It doesn't matter if I use:
> @Path(name = "logger", def = "root")
>
> Adding schema = @Schema(required = false) to @Path for "level" doesn't
> help, even if I put it as the 1st attribute in the @Path.
>
> My only remedy is to use:
>
> @Path(name = "level") final String levelName /* NO DEFAULT "def" ALLOWED!
> */
>
> Any ideas?
>
> Thank you,
> Gary
>
>
>