Skip to content

Commit

Permalink
Merge pull request #4200 from Coduz/fix-serviceConfigExceptionInfoKap…
Browse files Browse the repository at this point in the history
…uaIdMapping

🐛 [REST API] Fixed XML mapping for `ServiceConfiguration*ExceptionInfo` `scopeId` property
  • Loading branch information
Coduz authored Feb 20, 2025
2 parents 71d2410 + 143add4 commit 9e83a3d
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

import org.eclipse.kapua.commons.configuration.exception.ServiceConfigurationLimitExceededException;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.model.id.KapuaIdAdapter;
import org.eclipse.kapua.service.config.KapuaConfigurableService;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(name = "serviceConfigurationLimitExceededExceptionInfo")
@XmlAccessorType(XmlAccessType.FIELD)
Expand All @@ -30,6 +32,7 @@ public class ServiceConfigurationLimitExceededExceptionInfo extends ExceptionInf
private String servicePid;

@XmlElement(name = "scopeId")
@XmlJavaTypeAdapter(KapuaIdAdapter.class)
private KapuaId scopeId;

@XmlElement(name = "limitExceededBy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

import org.eclipse.kapua.commons.configuration.exception.ServiceConfigurationParentLimitExceededException;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.model.id.KapuaIdAdapter;
import org.eclipse.kapua.service.config.KapuaConfigurableService;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(name = "serviceConfigurationParentLimitExceededExceptionInfo")
@XmlAccessorType(XmlAccessType.FIELD)
Expand All @@ -30,7 +32,7 @@ public class ServiceConfigurationParentLimitExceededExceptionInfo extends Except
private String servicePid;

@XmlElement(name = "parentScopeId")

@XmlJavaTypeAdapter(KapuaIdAdapter.class)
private KapuaId parentScopeId;

@XmlElement(name = "limitExceededBy")
Expand Down
48 changes: 4 additions & 44 deletions rest-api/resources/src/main/resources/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -718,50 +718,6 @@ components:
message: "An illegal value was provided for the argument user.email: null"
kapuaErrorCode: "ILLEGAL_NULL_ARGUMENT"
argumentName: "user.email"
ServiceConfigurationLimitExceededExceptionInfo:
description: The update of the configuration for the service exceeds available resources of the current scope
allOf:
- $ref: '#/components/schemas/exceptionInfo'
- properties:
scopeId:
description: The scope for which limit has been exceeded
$ref: '#/components/schemas/kapuaId'
servicePid:
type: string
description: The Pid of the service
limitExceededBy:
type: string
description: The amount of excess
example:
type: "ServiceConfigurationLimitExceededExceptionInfo"
httpErrorCode: 400
message: "The maximum of resources for the org.eclipse.kapua.service.account.AccountService service for the account 2 has been exceeded. The resource limit is exceeded by 3."
kapuaErrorCode: "LIMIT_EXCEEDED"
scopeId: 2
servicePid: "org.eclipse.kapua.service.account.AccountService"
limitExceededBy: 3
ServiceConfigurationParentLimitExceededExceptionInfo:
description: The update of the configuration for the service exceeds available resources of the parent scope
allOf:
- $ref: '#/components/schemas/exceptionInfo'
- properties:
parentScopeId:
description: The parent scope for which limit has been exceeded
$ref: '#/components/schemas/kapuaId'
servicePid:
type: string
description: The Pid of the service
limitExceededBy:
type: string
description: The amount of excess
example:
type: "ServiceConfigurationLimitExceededExceptionInfo"
httpErrorCode: 400
message: "The maximum of resources for the org.eclipse.kapua.service.account.AccountService service for the parent account 2 has been exceeded."
kapuaErrorCode: "PARENT_LIMIT_EXCEEDED"
scopeId: 2
servicePid: "org.eclipse.kapua.service.account.AccountService"
limitExceededBy: 3
entityUniquenessExceptionInfo:
description: The object to represent the fact that an Entity with the same unique fields is already present in the system
allOf:
Expand Down Expand Up @@ -1200,6 +1156,10 @@ components:
$ref: './serviceConfiguration/serviceConfiguration.yaml#/components/schemas/option'
serviceAttributeDefinition:
$ref: './serviceConfiguration/serviceConfiguration.yaml#/components/schemas/attributeDefinition'
serviceConfigurationLimitExceededExceptionInfo:
$ref: './serviceConfiguration/serviceConfiguration.yaml#/components/schemas/serviceConfigurationLimitExceededExceptionInfo'
serviceConfigurationParentLimitExceededExceptionInfo:
$ref: './serviceConfiguration/serviceConfiguration.yaml#/components/schemas/serviceConfigurationParentLimitExceededExceptionInfo'
serviceConfigurationUpdateForbiddenExceptionInfo:
$ref: './serviceConfiguration/serviceConfiguration.yaml#/components/schemas/serviceConfigurationUpdateForbiddenExceptionInfo'
### System Info Entities ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ paths:
application/json:
schema:
oneOf:
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/responses/illegalArgument/content/application~1json/schema'
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationParentLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalArgumentExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalNullArgumentExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationLimitExceededExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationParentLimitExceededExceptionInfo'
application/xml:
schema:
oneOf:
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/responses/illegalArgument/content/application~1xml/schema'
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationParentLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalArgumentExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalNullArgumentExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationLimitExceededExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationParentLimitExceededExceptionInfo'
xml:
name: 'ServiceConfigurationLimitExceededExceptionInfo'
name: 'serviceConfigurationLimitExceededExceptionInfo'
401:
$ref: '../openapi.yaml#/components/responses/unauthenticated'
403:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ paths:
application/json:
schema:
oneOf:
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/responses/illegalArgument/content/application~1json/schema'
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationParentLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalArgumentExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalNullArgumentExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationLimitExceededExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationParentLimitExceededExceptionInfo'
application/xml:
schema:
oneOf:
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/responses/illegalArgument/content/application~1xml/schema'
- $ref: '../openapi.yaml#/components/schemas/ServiceConfigurationParentLimitExceededExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalArgumentExceptionInfo'
- $ref: '../openapi.yaml#/components/schemas/illegalNullArgumentExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationParentLimitExceededExceptionInfo'
- $ref: './serviceConfiguration.yaml#/components/schemas/serviceConfigurationLimitExceededExceptionInfo'
xml:
name: 'ServiceConfigurationLimitExceededExceptionInfo'
name: 'serviceConfigurationLimitExceededExceptionInfo'
401:
$ref: '../openapi.yaml#/components/responses/unauthenticated'
403:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,50 @@ components:
type: integer

### Exception Info
serviceConfigurationLimitExceededExceptionInfo:
description: The update of the configuration for the service exceeds available resources of the current scope
allOf:
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- properties:
scopeId:
description: The scope for which limit has been exceeded
$ref: '../openapi.yaml#/components/schemas/kapuaId'
servicePid:
type: string
description: The Pid of the service
limitExceededBy:
type: string
description: The amount of excess
example:
type: "ServiceConfigurationLimitExceededExceptionInfo"
httpErrorCode: 400
message: "The maximum of resources for the org.eclipse.kapua.service.account.AccountService service for the account 2 has been exceeded. The resource limit is exceeded by 3."
kapuaErrorCode: "LIMIT_EXCEEDED"
scopeId: 2
servicePid: "org.eclipse.kapua.service.account.AccountService"
limitExceededBy: 3
serviceConfigurationParentLimitExceededExceptionInfo:
description: The update of the configuration for the service exceeds available resources of the parent scope
allOf:
- $ref: '../openapi.yaml#/components/schemas/exceptionInfo'
- properties:
parentScopeId:
description: The parent scope for which limit has been exceeded
$ref: '../openapi.yaml#/components/schemas/kapuaId'
servicePid:
type: string
description: The Pid of the service
limitExceededBy:
type: string
description: The amount of excess
example:
type: "ServiceConfigurationLimitExceededExceptionInfo"
httpErrorCode: 400
message: "The maximum of resources for the org.eclipse.kapua.service.account.AccountService service for the parent account 2 has been exceeded."
kapuaErrorCode: "PARENT_LIMIT_EXCEEDED"
scopeId: 2
servicePid: "org.eclipse.kapua.service.account.AccountService"
limitExceededBy: 3
serviceConfigurationUpdateForbiddenExceptionInfo:
description: The update of the configuration for the service contains an update to a property than cannot be updated
allOf:
Expand Down

0 comments on commit 9e83a3d

Please sign in to comment.