Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

POJO generation without additional properties plugin, but with additional properties allowed is not supported #660

@akomisarek

Description

@akomisarek

because of problems with:
CJSCommonPlatform/utilities#27

I have tried to find another workaround so I have disabled the additionalProperties plugin, which leads to classes generated without additionalProperties map.

However this didn't solve my problem, as now when I push additional property to the API the code complains it is unrecognized property.

10:05:15,776 ERROR [io.undertow.request] (default task-15) {"serviceContext":"stagingprosecutors-service","Content-Type":"application/vnd.stagingprosecutors.submit-sjp-prosecution+json","metadata":{"context":{"user":"f1c00555-714c-4c9a-b708-ecda045e5cdd"}}} UT005023: Exception handling request to /stagingprosecutors-service/command/api/rest/stagingprosecutors/submit-sjp-prosecution: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException: Unrecognized field "abc" (class uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails), not marked as ignorable (4 known properties: "urn", "sjpnPostingDate", "prosecutingAuthority", "informant"])
 at [Source: N/A; line: -1, column: -1] (through reference chain: uk.gov.moj.cpp.staging.prosecutors.json.schemas.SubmitSjpProsecutionHttp["prosecutionSubmissionDetails"]->uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails["abc"])
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.MetricsHandler.handleRequest(MetricsHandler.java:62)
	at io.undertow.servlet.core.MetricsChainHandler.handleRequest(MetricsChainHandler.java:59)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Unrecognized field "abc" (class uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails), not marked as ignorable (4 known properties: "urn", "sjpnPostingDate", "prosecutingAuthority", "informant"])
 at [Source: N/A; line: -1, column: -1] (through reference chain: uk.gov.moj.cpp.staging.prosecutors.json.schemas.SubmitSjpProsecutionHttp["prosecutionSubmissionDetails"]->uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails["abc"])
	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3605)
	at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3524)
	at uk.gov.justice.services.core.dispatcher.EnvelopePayloadTypeConverter.convert(EnvelopePayloadTypeConverter.java:49)
	at uk.gov.justice.services.core.dispatcher.MethodInvoker.toTargetEnvelopeType(MethodInvoker.java:49)
	at uk.gov.justice.services.core.dispatcher.MethodInvoker.invoke(MethodInvoker.java:45)
	at uk.gov.justice.services.core.dispatcher.Dispatcher.dispatch(Dispatcher.java:46)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChainProcessor.lambda$targetOf$0(DefaultInterceptorChainProcessor.java:40)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChain.processNext(DefaultInterceptorChain.java:22)
	at uk.gov.justice.services.core.accesscontrol.LocalAccessControlInterceptor.process(LocalAccessControlInterceptor.java:29)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChain.processNext(DefaultInterceptorChain.java:25)
	at uk.gov.justice.services.core.audit.LocalAuditInterceptor.process(LocalAuditInterceptor.java:25)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChain.processNext(DefaultInterceptorChain.java:25)
	at uk.gov.justice.services.metrics.interceptor.AbstractMetricsInterceptor.process(AbstractMetricsInterceptor.java:21)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChain.processNext(DefaultInterceptorChain.java:25)
	at uk.gov.justice.services.metrics.interceptor.AbstractMetricsInterceptor.process(AbstractMetricsInterceptor.java:21)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChain.processNext(DefaultInterceptorChain.java:25)
	at uk.gov.justice.services.core.interceptor.DefaultInterceptorChainProcessor.process(DefaultInterceptorChainProcessor.java:27)
	at uk.gov.justice.services.adapter.rest.processor.DefaultRestProcessor.process(DefaultRestProcessor.java:104)
	at uk.gov.justice.services.adapter.rest.processor.DefaultRestProcessor.process(DefaultRestProcessor.java:67)
	at uk.gov.justice.services.adapter.rest.processor.DefaultRestProcessor$Proxy$_$$_WeldClientProxy.process(Unknown Source)
	at uk.gov.justice.api.resource.DefaultCommandApiSubmitSjpProsecutionResource.postStagingprosecutorsSubmitSjpProsecutionSubmitSjpProsecution(DefaultCommandApiSubmitSjpProsecutionResource.java:56)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
	... 34 more
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "abc" (class uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails), not marked as ignorable (4 known properties: "urn", "sjpnPostingDate", "prosecutingAuthority", "informant"])
 at [Source: N/A; line: -1, column: -1] (through reference chain: uk.gov.moj.cpp.staging.prosecutors.json.schemas.SubmitSjpProsecutionHttp["prosecutionSubmissionDetails"]->uk.gov.moj.cpp.staging.prosecutors.json.schemas.ProsecutionSubmissionDetails["abc"])
	at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1093)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1489)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperties(BeanDeserializerBase.java:1443)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:421)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1191)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:511)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:400)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1191)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)
	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3600)
	... 63 more

@allanmckenzie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions