1 example
Invalid enum value
Enum set to an invalid or unintended value.
[ FAQ1 ]
What is an invalid enum value?
An invalid enum value occurs when a program tries to assign or use a value that isn’t part of the explicitly defined set of values in an enumerated type (enum). Enums help enforce specific allowed values, but providing an invalid value—typically due to user input, data inconsistencies, or logic errors—leads to type mismatches, validation failures, or unexpected application behavior. Such errors frequently arise in applications using strict schemas or data validation mechanisms, resulting in errors at compile-time, runtime, or during schema validation.
[ FAQ2 ]
How to fix invalid enum value errors
To fix invalid enum value errors, validate all inputs rigorously before assigning or processing enum values, ensuring inputs strictly match defined enum options. Clearly define enum types with comprehensive error checking to detect unexpected values early. Implement fallback mechanisms or default values for cases where inputs may not align perfectly with enums, ensuring application stability. Regularly audit code logic, schemas, and data sources to proactively identify and correct mismatches or validation issues involving enum values.
diff block
+openapi: 3.0.3
+info:
+ title: Egardia - Sunrise API
+ description: |-
+ This is the current suggestion for the API exposed by Egardia for Sunrise provisioning.
+ <br><br>
+ **Changelog** <br><br>
+ *2025-02-03*:
+ - Add all possible error codes for the response of `/order`
+ - Add deviceDetails to `/order` response as a solution to the change from asynchronous calls to synchronous calls
+
+ *2025-01-28*:
+ - Removed orderType `DOWNGRADE` from the possibilities of orderType
+
+ *2024-11-15*:
+ - Parameters made required for `/order` for orderType of `ACTIVATION` or `MODIFY`:
+ - `orderType`
+ - `ratePlanDetails`
+ - `locale`
+ - `deviceDetails` (can be an empty list)
+ - Parameters made not required for any orderType:
+ - `orderStatus`
+ - Parameters not required (or desired/expected) for orderType of `CEASE` or `SUSPEND`:
+ - `customerContactDetails` (and children)
+ - `locale`
+ - `customerAddress` (and children)
+ - `companyName`, `ratePlanDetails` (and children)
+ - `subscriptionType`
+ - `deviceDetails` (and children)
+ - `contractExtensionInd`
+ - `serviceId`
+ - `technicianInstallation`
+ - Renamed `egardiaProvStatus` in `egardiaHomeSecurityResponse` to `status`
+ - Renamed `egardiaErrorMessage` in `egardiaHomeSecurityResponse` to `error`
+ - Added minLength and maxLength for all applicable fields based on original documentation + later change requests
+ - Addition of required parameter `customerTitle` to `customerDetails`
+
+ *2024-10-21*:
+ - (For now) Do any changes to sites through orders. This means the PATCH/DELETE calls on /site will be removed. However, still allow devices to be retrieved directly.
+ - Add order type to response for /order
+ - Added possible error messages in /order response
+ - To check with Sunrise: How to expose Egardia provisioning progress, such as PENDING/PROVISIONING/PROVISIONED.
+
+ *2024-09-24*:
+ - Updated the details and examples of some of the changes as made on 2024-09-13
+ - Status and error description removed for /homeSecurity/confirmation. Any errors will cause the confirmation step to not be called.
+ - Removed device details from required fields for /homeSecurity/confirmation (for example in case of cease)
+
+ *2024-09-23*:
+ - orderType should be a capitalized string. So "ACTIVATION" rather than "Activation"
+
+ *2024-09-20*:
+ - device path: change /devices to /device to make sure everything is singular
+ - servers and paths: change to use the correct paths
+ - Note regarding OpenID connect: the redirect uri will be `/sunrise/sso/code/sunrise`. Unlike the rest endpoints, this will not be versioned
+ - Added authorization of the /homeSecurity/confirmation
+
+ *2024-09-18*:
+ - deviceDetails: Clarification of the device details
+
+ *2024-09-13*:
+ - orderCreateDate: change from date string to timestamp
+ - locale: change format from en-GB to en
+ - egardieAck -> egardiaProvStatus and optional egardiaErrorMsg
+
+ *2024-09-02*:
+ - Split the concept of orders into orders and accounts: An order provisions the account and the site. Any further changes (i.e. suspension, name change) are done through REST calls on the account/site
+ - Removal of orderStartDate: it is assumed that Egardia will provision the account/site as soon as the order is posted.
+ - Addition of locale: a locale in the form en-GB is added in the order based on the locale set in the Sunrise account
+ - Removal of obsolete properties orderCreateDate in /homeSecurity/confirmation
+
+ *2024-04-24*
+ - Initial version of the API
+ contact:
+ email: remy.kabel@egardia.com
+ version: v2 2025-02-03
+servers:
+ - url: https://sunrise-test-1.egardia.info/sunrise/v1
+ description: Sunrise specific Egardia development platform
+ - url: https://test.egardia.info/sunrise/v1
+ description: Egardia development platform
+ - url: https://my.egardia.com/sunrise/v1
+ description: Egardia production platform
+tags:
+ - name: Egardia
+ description: The expected API endpoints on the Egardia side
+ - name: Sunrise
+ description: The expected API endpoints on the Sunrise side
+paths:
+ /order (orderType=[ACTIVATION,MODIFY]):
+ post:
+ tags:
+ - Egardia
+ summary: This will prepare the provisioning of a new Sunrise customer at Egardia or change an existing one based on the order details. The order will always be seen as the new state.
+ parameters:
+ - $ref: '#/components/parameters/EgardiaApiKey'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: '#/components/schemas/egardiaHomeSecurityRequest'
+ - required: [orderDetails, locale, transactionId, siteId, customerContactDetails, customerAddress, ratePlanDetails, subscriptionType, deviceInfo, technicianInstallation, deviceDetails]
+ responses:
+ '200':
+ description: Accepted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/egardiaHomeSecurityResponse'
+
+ '400':
+ description: Bad Request, Validation Error
+ '404':
+ description: No active site with this siteId found (modify only)
+ '409':
+ description: |
+ An active site already exists for this:
+ - orderId
+ - siteId (activation only)
+ - customerEmail
+ - deviceSerialNumber
+
+ '500':
+ description: Internal server error
+
+ /order (orderType=[SUSPEND,CEASE]):
+ post:
+ tags:
+ - Egardia
+ summary: This will prepare the deprovisioning of an existing site. In both cases, the connected devices will be deprovisioned. However, in case of SUSPEND, the account will not be removed.
+ parameters:
+ - $ref: '#/components/parameters/EgardiaApiKey'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: '#/components/schemas/egardiaHomeSecurityRequestBase'
+ - required: [orderDetails, transactionId, siteId]
+ - example: {
+ "orderDetails": {
+ "orderType": "SUSPEND",
+ "orderId": "O094512701",
+ "orderCreateDate": "2024-10-19T12:35:00Z"
+ },
+ "transactionId": "20241019123530000000",
+ "siteId": "5144016778"
+ }
+ responses:
+ '200':
+ description: Accepted
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: '#/components/schemas/egardiaHomeSecurityResponse'
+ - example:
+ transactionId: "string"
+ orderId: "O094512701"
+ orderType: "SUSPEND"
+ siteId: "5144016778"
+ status: "SUCCESS"
+ deviceDetails: []
+ '400':
+ description: Bad Request, Validation Error
+ '404':
+ description: No active site with this siteId found
+ '500':
+ description: Internal server error
+
+ /site/{siteId}:
+ parameters:
+ - in: path
+ name: siteId
+ schema:
+ type: string
+ required: true
+ description: Identifier of the Sunrise site
+ - $ref: '#/components/parameters/EgardiaApiKey'
+ get:
+ tags:
+ - Egardia
+ summary: This gets an existing account for a sunrise site Id
+ responses:
+ '200':
+ description: Retrieve the site details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/egardiaHomeSecuritySite'
+ '400':
+ description: Bad Request, Validation Error
+ '404':
+ description: Not Found
+ '500':
+ description: Internal server error
+
+ /homeSecurity/confirmation:
+ post:
+ tags:
+ - Sunrise
+ operationId: processConfirmationNotification
+ summary: Kafka step to Process the confirmation notification sent by Egardia
+ parameters:
+ - $ref: '#/components/parameters/CorrelationId'
+ - $ref: '#/components/parameters/SunriseChannel'
+ - $ref: '#/components/parameters/ExternalReferenceId'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/confirmHomeSecurityRequest'
+ responses:
+ '201':
+ description: Added
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/confirmHomeSecurityResponse'
+ '400':
+ description: Bad Request, Validation Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationError'
+ '500':
+ description: Internal server error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationError'
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationError'
+
+components:
+ parameters:
+ CorrelationId:
+ in: header
+ name: x-correlation-id
+ schema:
+ type: string
+ required: true
+ description: Unique ID to track in logging. Can be defined by egardia but must be unique.
+ SunriseChannel:
+ in: header
+ name: x-sunrise-channel
+ schema:
+ type: string
+ default: SUNRISE
+ required: true
+ description: Integration identifier.
+ ExternalReferenceId:
+ in: header
+ name: x-sunrise-external-reference-id
+ schema:
+ type: string
+ required: false
+ EgardiaApiKey:
+ in: header
+ name: x-egardia-api-key
+ schema:
+ type: string
+ required: true
+ description: Secret API key used to verify the request comes from Sunrise. Shared to Sunrise by Egardia
+
+ schemas:
+ confirmHomeSecurityRequest:
+ type: object
+ required: [transactionId, orderType, orderId, siteId]
+ properties:
+ transactionId:
+ type: string
+ description: Same transaction id as sent in the original request from Sunrise for the Customer account creation. (Same as in inbound request from Sunrise)
+ example: 20240419123530000000
+ orderType:
+ type: string
+ enum:
+ - ACTIVATION
+ - CEASE
+ - SUSPEND
+ - MODIFY
+ orderId:
+ $ref: '#/components/schemas/orderId'
+ siteId:
+ $ref: '#/components/schemas/siteId'
+ deviceDetails:
+ type: array
+ items:
+ $ref: '#/components/schemas/deviceInfo'
+ confirmHomeSecurityResponse:
+ type: object
+ required: [transactionId, srAck, orderId, siteId]
+ properties:
+ transactionId:
+ type: string
+ description: Same transaction id as sent in the original request from Sunrise for the Customer account creation. (Same as in inbound request from Sunrise)
+ example: 20240419123530000000
+ srAck:
+ type: string
+ description: Sunrise acknowledgement for Egardia (de)provisioning message
+ example: OK
+ enum:
+ - OK
+ - NOK
+ orderId:
+ $ref: '#/components/schemas/orderId'
+ siteId:
+ $ref: '#/components/schemas/siteId'
+ egardiaHomeSecurityResponse:
+ type: object
+ required: [transactionId, orderType, orderId, siteId, status, deviceDetails]
+ properties:
+ transactionId:
+ type: string
+ description: Same transaction id as sent in the original request from Sunrise for the Customer account creation. (Same as in inbound request from Sunrise)
+ orderType:
+ type: string
+ enum:
+ - ACTIVATION
+ - CEASE
+ - SUSPEND
+ - MODIFY
+ orderId:
+ $ref: '#/components/schemas/orderId'
+ siteId:
+ $ref: '#/components/schemas/siteId'
+ status:
+ type: string
+ description: Developer readable status string
+ enum:
+ - SUCCESS
+ - ERROR
+ - ERROR_MISSING_GATEWAY,
greptile
syntax: Invalid enum value format - remove trailing comma
suggested fix
+ - ERROR_MISSING_GATEWAY
Want to avoid this bug in your codebase? Try Greptile.
Avoid this bug!