Fix dns schema mapping names
some schemas were accidentially plural causing mismatch. In addition to that recordset was missing records attribute (missed in the current api-ref) and zone/recordset supports only limited set of updatable attributes. Change-Id: I51b3a93caa1fc8804e40493636bde537a58950a3
This commit is contained in:
@@ -168,6 +168,27 @@ ZONE_SCHEMA: dict[str, Any] = {
|
|||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZONE_UPDATE_REQUEST_SCHEMA: dict[str, Any] = {
|
||||||
|
"type": "object",
|
||||||
|
"description": "DNS Zone",
|
||||||
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"description": "e-mail for the zone. Used in SOA records for the zone",
|
||||||
|
},
|
||||||
|
"ttl": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "TTL (Time to Live) for the zone.",
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Description for this zone",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"additionalProperties": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ZONES_SCHEMA: dict[str, Any] = {
|
ZONES_SCHEMA: dict[str, Any] = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -420,7 +441,6 @@ RECORDSET_SCHEMA: dict[str, Any] = {
|
|||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "uuid",
|
|
||||||
"description": "DNS Name for the recordset",
|
"description": "DNS Name for the recordset",
|
||||||
},
|
},
|
||||||
"ttl": {
|
"ttl": {
|
||||||
@@ -459,6 +479,11 @@ RECORDSET_SCHEMA: dict[str, Any] = {
|
|||||||
"enum": RECORDSET_TYPES,
|
"enum": RECORDSET_TYPES,
|
||||||
"description": "They RRTYPE of the recordset.",
|
"description": "They RRTYPE of the recordset.",
|
||||||
},
|
},
|
||||||
|
"records": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"type": "string"},
|
||||||
|
"description": "A list of data for this recordset. Each item will be a separate record in Designate These items should conform to the DNS spec for the record type - e.g. A records must be IPv4 addresses, CNAME records must be a hostname.",
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"readOnly": True,
|
"readOnly": True,
|
||||||
@@ -485,6 +510,27 @@ RECORDSET_SCHEMA: dict[str, Any] = {
|
|||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RECORDSET_UPDATE_REQUEST_SCHEMA: dict[str, Any] = {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Zone Record object",
|
||||||
|
"properties": {
|
||||||
|
"ttl": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "TTL (Time to Live) for the recordset.",
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Description for this recordset",
|
||||||
|
},
|
||||||
|
"records": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"type": "string"},
|
||||||
|
"description": "A list of data for this recordset. Each item will be a separate record in Designate These items should conform to the DNS spec for the record type - e.g. A records must be IPv4 addresses, CNAME records must be a hostname.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"additionalProperties": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RECORDSETS_SCHEMA: dict[str, Any] = {
|
RECORDSETS_SCHEMA: dict[str, Any] = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -781,11 +827,15 @@ def _get_schema_ref(
|
|||||||
"ZoneShowResponse",
|
"ZoneShowResponse",
|
||||||
"ZonesCreateRequest",
|
"ZonesCreateRequest",
|
||||||
"ZonesCreateResponse",
|
"ZonesCreateResponse",
|
||||||
"ZonesUpdateRequest",
|
"ZoneUpdateResponse",
|
||||||
"ZonesUpdateResponse",
|
|
||||||
]:
|
]:
|
||||||
openapi_spec.components.schemas[name] = TypeSchema(**ZONE_SCHEMA)
|
openapi_spec.components.schemas[name] = TypeSchema(**ZONE_SCHEMA)
|
||||||
ref = f"#/components/schemas/{name}"
|
ref = f"#/components/schemas/{name}"
|
||||||
|
if name in ["ZoneUpdateRequest"]:
|
||||||
|
openapi_spec.components.schemas[name] = TypeSchema(
|
||||||
|
**ZONE_UPDATE_REQUEST_SCHEMA
|
||||||
|
)
|
||||||
|
ref = f"#/components/schemas/{name}"
|
||||||
elif name in ["ZonesListResponse"]:
|
elif name in ["ZonesListResponse"]:
|
||||||
openapi_spec.components.schemas[name] = TypeSchema(**ZONES_SCHEMA)
|
openapi_spec.components.schemas[name] = TypeSchema(**ZONES_SCHEMA)
|
||||||
ref = f"#/components/schemas/{name}"
|
ref = f"#/components/schemas/{name}"
|
||||||
@@ -793,11 +843,15 @@ def _get_schema_ref(
|
|||||||
"ZonesRecordsetShowResponse",
|
"ZonesRecordsetShowResponse",
|
||||||
"ZonesRecordsetsCreateRequest",
|
"ZonesRecordsetsCreateRequest",
|
||||||
"ZonesRecordsetsCreateResponse",
|
"ZonesRecordsetsCreateResponse",
|
||||||
"ZonesRecordsetsUpdateRequest",
|
"ZonesRecordsetUpdateResponse",
|
||||||
"ZonesRecordsetsUpdateResponse",
|
|
||||||
]:
|
]:
|
||||||
openapi_spec.components.schemas[name] = TypeSchema(**RECORDSET_SCHEMA)
|
openapi_spec.components.schemas[name] = TypeSchema(**RECORDSET_SCHEMA)
|
||||||
ref = f"#/components/schemas/{name}"
|
ref = f"#/components/schemas/{name}"
|
||||||
|
elif name in ["ZonesRecordsetUpdateRequest"]:
|
||||||
|
openapi_spec.components.schemas[name] = TypeSchema(
|
||||||
|
**RECORDSET_UPDATE_REQUEST_SCHEMA
|
||||||
|
)
|
||||||
|
ref = f"#/components/schemas/{name}"
|
||||||
elif name in ["ZonesRecordsetsListResponse", "RecordsetsListResponse"]:
|
elif name in ["ZonesRecordsetsListResponse", "RecordsetsListResponse"]:
|
||||||
openapi_spec.components.schemas[name] = TypeSchema(**RECORDSETS_SCHEMA)
|
openapi_spec.components.schemas[name] = TypeSchema(**RECORDSETS_SCHEMA)
|
||||||
ref = f"#/components/schemas/{name}"
|
ref = f"#/components/schemas/{name}"
|
||||||
|
Reference in New Issue
Block a user