Giter Site home page Giter Site logo

Issue with schema validation about chakram HOT 9 CLOSED

dareid avatar dareid commented on August 26, 2024
Issue with schema validation

from chakram.

Comments (9)

dareid avatar dareid commented on August 26, 2024

Could you provide the data structure you are validating

from chakram.

syed12304 avatar syed12304 commented on August 26, 2024

This is the schema:

var expectSchema = {
"type":"object",
properties: {
created_at: {type: 'string'},
created_by: {type: 'number'},
description: {type: 'string'}
},
required: [
'description',
'created_by'
]
};

JSON Response to validate:
{ collaborators: null,
created_at: '2016-05-11T15:29:27Z',
created_by: '************',
description: 'Source edited by Test',
name: 'abc',

updated_at: '2016-05-11T15:29:27Z',
updated_by: '**********' }

from chakram.

harryrose avatar harryrose commented on August 26, 2024

@syed12304 Looking at your schema, you've stated that created_by is a number, but in the object you're passing, created_by is a string. Failing JSON schema validation in this case is expected behaviour, therefore I will be closing this issue. If you think this demonstrates a problem/shortcoming with chakram, please feel free to reopen.

from chakram.

syed12304 avatar syed12304 commented on August 26, 2024

changing the created_by schema as string also returns the same error...

from chakram.

dareid avatar dareid commented on August 26, 2024

what error are you getting?

from chakram.

syed12304 avatar syed12304 commented on August 26, 2024

error: Invalid type: undefined (expected object).
data path: .
schema path: /type.

........................pm ERR! Test failed. See above for more details.

from chakram.

asosa9991 avatar asosa9991 commented on August 26, 2024

Could you please advise how this issue was resolved?

Below us what I am getting --

Schema = {
"type": "object",
"required": [
"name",
"place"
],
"properties": {
"name": {
"type": "string"
},
"place": {
"type": "string"
}
}
}
Data = {
"name": "HELLO",
"place": "WORLD"
}

 AssertionError: expected body to match JSON schema {

"type": "object",
"required": [
"name",
"place"
],
"properties": {
"name": {
"type": "string"
},
"place": {
"type": "string"
}
}
}.

error: Invalid type: undefined (expected object).
data path: .
schema path: /type.
at simpleCall.js:28:35
at _fulfilled (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:816:13)
at xxxxx\chakram-testing\node_modules\q\q.js:624:44
at runSingle (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:137:13)
at flush (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

from chakram.

skhromchenko avatar skhromchenko commented on August 26, 2024

Did anyone get this issue resolved?

from chakram.

Wilt avatar Wilt commented on August 26, 2024

If you get undefined, most likely your response object is empty.
Maybe you get a 401 (Unauthorized) response with an empty (so undefined) body.

from chakram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.