cancel
Showing results for 
Search instead for 
Did you mean: 

Assertions: Json Schema complaince

SOLVED
patilawaken
Occasional Contributor

Assertions: Json Schema complaince

I want to use the Json schema complaince assertion in Ready API for API  response schema validation.

While adding assetion, Its required to add the Schema URL,

  • What is this URL?
  • What does this URL consists of?
  • I dont have any schema URL, I have only json schema stored in a file.
1 ACCEPTED SOLUTION

Accepted Solutions
avidCoder
Super Contributor

Re: Assertions: Json Schema complaince

This url can be any normal url link which contains JSON schemas.

 

For example - http://example.com/docs/path/employee.json

 

Which contains the schemas like this:-

{
  "$id": "https://example.com/person.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Person",
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "description": "The person's first name."
    },
    "lastName": {
      "type": "string",
      "description": "The person's last name."
    },
    "age": {
      "description": "Age in years which must be equal to or greater than zero.",
      "type": "integer",
      "minimum": 0
    }
  }
}

So, in your case, I guess, you cannot use this JSON Schema complaince. Since, you don't have the urls.

You can use JSON Path Assertions.

View solution in original post

3 REPLIES 3
avidCoder
Super Contributor

Re: Assertions: Json Schema complaince

This url can be any normal url link which contains JSON schemas.

 

For example - http://example.com/docs/path/employee.json

 

Which contains the schemas like this:-

{
  "$id": "https://example.com/person.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Person",
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "description": "The person's first name."
    },
    "lastName": {
      "type": "string",
      "description": "The person's last name."
    },
    "age": {
      "description": "Age in years which must be equal to or greater than zero.",
      "type": "integer",
      "minimum": 0
    }
  }
}

So, in your case, I guess, you cannot use this JSON Schema complaince. Since, you don't have the urls.

You can use JSON Path Assertions.

View solution in original post

TanyaYatskovska
Community Manager

Re: Assertions: Json Schema complaince

Thanks for the suggestion, @avidCoder!

 

@patilawaken, is this what you are looking for?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
patilawaken
Occasional Contributor

Re: Assertions: Json Schema complaince

 Thanks

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors