-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from Divyeshhhh/json-schema-validation-in-rev…
…iews use json schema validation in reviews api controller
- Loading branch information
Showing
9 changed files
with
255 additions
and
121 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://example.com/common/review.json", | ||
"title": "Review", | ||
"description": "A review object", | ||
"type": "object", | ||
"properties": { | ||
"review_id": { | ||
"type": "integer", | ||
"description": "Unique identifier for review" | ||
}, | ||
"rating": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 5, | ||
"description": "Rating of the product" | ||
}, | ||
"created_date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "The date and time when the review was created" | ||
}, | ||
"text": { | ||
"type": "string", | ||
"minLength": 2, | ||
"maxLength": 2000, | ||
"description": "The text of the review" | ||
}, | ||
"client_id": { | ||
"type": "integer", | ||
"description": "Identifier for the client who wrote the review" | ||
}, | ||
"product_id": { | ||
"type": "integer", | ||
"description": "Identifier for the product being reviewed" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://example.com/reviews/create.json", | ||
"title": "Create Review", | ||
"properties": { | ||
"rating": { | ||
"$ref": "https://example.com/common/review.json#/properties/rating" | ||
}, | ||
"text": { | ||
"$ref": "https://example.com/common/review.json#/properties/text" | ||
}, | ||
"client_id": { | ||
"$ref": "https://example.com/common/review.json#/properties/client_id" | ||
}, | ||
"product_id": { | ||
"$ref": "https://example.com/common/review.json#/properties/product_id" | ||
} | ||
}, | ||
"required": [ | ||
"rating", | ||
"text", | ||
"client_id", | ||
"product_id" | ||
], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://example.com/reviews/update.json", | ||
"title": "Update Review", | ||
"properties": { | ||
"rating": { | ||
"$ref": "https://example.com/common/review.json#/properties/rating" | ||
}, | ||
"text": { | ||
"$ref": "https://example.com/common/review.json#/properties/text" | ||
}, | ||
"client_id": { | ||
"$ref": "https://example.com/common/review.json#/properties/client_id" | ||
}, | ||
"product_id": { | ||
"$ref": "https://example.com/common/review.json#/properties/product_id" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.