swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Required readonly properties should fail with Swagger 2

Open jfrconley opened this issue 6 years ago • 1 comments

EDIT: Upon closer inspection, the spec says "SHOULD NOT" not "MUST NOT". Meaning this is merely bad practice, not an error

According to the Swagger 2 spec, readOnly properties are not allowed to be required. The following schema should fail, but does not.

{
	"swagger": "2.0",
	"info": {
		"title": "Parser Bug",
		"version": "3.5.1"
	},
	"paths": {},
	"definitions": {
		"Burn": {
			"properties": {
				"id": {
					"type": "string",
					"readOnly": true
				}
			},
			"required": [
				"id"
			],
			"type": "object"
		}
	}
}

This does not apply to OA3

source

jfrconley avatar Jan 30 '19 01:01 jfrconley

The openapi-enforcer handles this correctly.

Gi60s avatar Oct 28 '19 17:10 Gi60s