'Get only content in schema builder
I am trying to build schema from my json response. and I am trying to access only content from schema builder, I don't want to access any other data from it.
full_response
{
"$schema": "http://json-schema.org/schema#",
"anyOf": [
{
"type": "object"
},
{
"type": "array",
"items": {
"type": "object",
"properties": {
"response": {
"type": "integer"
},
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
},
"required": [
"id",
"title"
]
}
}
},
"required": [
"content",
"response"
]
}
}
]
}
as you can see in response it shows all the data and I want to access only of content. But when I do it like
builder.add_schema({"type": "object", "properties": {},accitionalProperties": False})
builder.add_object(json)
builder.to_schema()
I have also tried by defining it like
builder.to_schema().content
but it says
AttributeError: 'str' object has no attribute 'content'
It is still showing everything.
I have tried many times but it still not showing. Any help would be much Appreciated. Thank You in Advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
