Skip to content

Commit

Permalink
fix: error schema fix (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandana-NNR authored Sep 25, 2024
1 parent 952ae9d commit 35217ad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 64 deletions.
76 changes: 21 additions & 55 deletions cypress/fixtures/schemas/errorSchema.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
{
"errorSchemaSDK": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message"
],
"properties": {
"code": {
"title": "errorObjectCode",
"description": "A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api.",
"type": "integer"
},
"message": {
"title": "errorObjectMessage",
"description": "A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.",
"type": "string"
},
"data": {
"title": "errorObjectData",
"description": "A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.)."
}
}
},
{
"type": "string"
}
]
},
"errorSchemaTransport": {
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message"
],
"properties": {
"code": {
"title": "errorObjectCode",
"description": "A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api.",
"type": "integer"
},
"message": {
"title": "errorObjectMessage",
"description": "A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.",
"type": "string"
},
"data": {
"title": "errorObjectData",
"description": "A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.)."
}
}
"errorSchema": {
"type": "object",
"additionalProperties": false,
"required": ["code", "message"],
"properties": {
"code": {
"title": "errorObjectCode",
"description": "A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api.",
"type": "integer"
},
"message": {
"title": "errorObjectMessage",
"description": "A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.",
"type": "string"
},
"data": {
"title": "errorObjectData",
"description": "A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.)."
}
}
}
}
}
2 changes: 0 additions & 2 deletions cypress/support/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ module.exports = {
ERROR_NOT_UNDEFINED_CHECK: 'Error not undefined Check',
ERROR_NULL_CHECK: 'Error null Check',
ERROR_CONTENT_OBJECTS_PATH: 'cypress/fixtures/objects/errorContentObjects.json',
ERROR_SCHEMA_SDK: 'errorSchemaSDK',
ERROR_SCHEMA_TRANSPORT: 'errorSchemaTransport',
EVENT: 'event',
EVENT_ERROR_MSG: 'Event listener error validation',
EVENT_LISTENER_RESPONSE: 'eventListenerResponse',
Expand Down
9 changes: 2 additions & 7 deletions cypress/support/validations/schemaValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,8 @@ Cypress.Commands.add('getSchema', (methodOrEvent, params, schemaType) => {
let schemaMap = null;

if (schemaType == CONSTANTS.ERROR) {
cy.fixture(CONSTANTS.OPENRPC_ERROR_SCHEMA_PATH).then((errorSchema) => {
const communicationMode = UTILS.getCommunicationMode();
const errorSchemaBasedOnMode =
communicationMode == CONSTANTS.MODE_TRANSPORT
? errorSchema[CONSTANTS.ERROR_SCHEMA_TRANSPORT]
: errorSchema[CONSTANTS.ERROR_SCHEMA_SDK];
return errorSchemaBasedOnMode;
cy.fixture(CONSTANTS.OPENRPC_ERROR_SCHEMA_PATH).then((errorSchemaObject) => {
return errorSchemaObject.errorSchema;
});
} else {
if (
Expand Down

0 comments on commit 35217ad

Please sign in to comment.