Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cors rule in request/response for Cosmos DB #10204

Merged
merged 3 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5207,6 +5207,38 @@
"defaultConsistencyLevel"
]
},
"CorsPolicy": {
"type": "object",
"description": "The CORS policy for the Cosmos DB database account.",
"properties": {
"allowedOrigins": {
"description": "The origin domains that are permitted to make a request against the service via CORS.",
"type": "string"
},
"allowedMethods": {
"description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request.",
"type": "string"
},
"allowedHeaders": {
"description": "The request headers that the origin domain may specify on the CORS request.",
"type": "string"
},
"exposedHeaders": {
"description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.",
"type": "string"
},
"maxAgeInSeconds": {
"description": "The maximum amount time that a browser should cache the preflight OPTIONS request.",
"type": "integer",
"minimum": 1,
"maximum": 2147483647,
"format": "int64"
}
},
"required": [
"allowedOrigins"
]
},
"DatabaseAccountGetProperties": {
"description": "Properties for the database account.",
"type": "object",
Expand Down Expand Up @@ -5351,6 +5383,10 @@
"description": "The object representing the policy for taking backups on an account.",
"type": "object",
"$ref": "#/definitions/BackupPolicy"
},
"cors": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding property in output is breaking change, which requires version bump

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yungezz, this property has been available to users in production for some time, but was undocumented in swagger. We cannot add a new API version and restrict it as only available in that version because we could break users currently consuming the property. Should we add a new API version and document it there even if it remains available in previous versions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for sharing, @shurd , just confirm, this PR is a fixing of Swagger bug actually right, not to introducing new property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct @yungezz

"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
}
},
Expand Down Expand Up @@ -5447,6 +5483,10 @@
"description": "The object representing the policy for taking backups on an account.",
"type": "object",
"$ref": "#/definitions/BackupPolicy"
},
"cors": {
"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
},
"required": [
Expand Down Expand Up @@ -5593,6 +5633,10 @@
"description": "The object representing the policy for taking backups on an account.",
"type": "object",
"$ref": "#/definitions/BackupPolicy"
},
"cors": {
"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"backupIntervalInMinutes": 240,
"backupRetentionIntervalInHours": 720
}
},
"cors": {
"allowedOrigins": "https://test"
}
}
}
Expand Down Expand Up @@ -158,6 +161,9 @@
"backupIntervalInMinutes": 240,
"backupRetentionIntervalInHours": 720
}
},
"cors": {
"allowedOrigins": "https://test"
}
},
"systemData": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5074,6 +5074,38 @@
"defaultConsistencyLevel"
]
},
"CorsPolicy": {
"type": "object",
"description": "The CORS policy for the Cosmos DB database account.",
"properties": {
"allowedOrigins": {
"description": "The origin domains that are permitted to make a request against the service via CORS.",
"type": "string"
},
"allowedMethods": {
"description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request.",
"type": "string"
},
"allowedHeaders": {
"description": "The request headers that the origin domain may specify on the CORS request.",
"type": "string"
},
"exposedHeaders": {
"description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.",
"type": "string"
},
"maxAgeInSeconds": {
"description": "The maximum amount time that a browser should cache the preflight OPTIONS request.",
"type": "integer",
"minimum": 1,
"maximum": 2147483647,
"format": "int64"
}
},
"required": [
"allowedOrigins"
]
},
"DatabaseAccountGetProperties": {
"description": "Properties for the database account.",
"type": "object",
Expand Down Expand Up @@ -5197,6 +5229,10 @@
"enableAnalyticalStorage": {
"description": "Flag to indicate whether to enable storage analytics.",
"type": "boolean"
},
"cors": {
"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
}
},
Expand Down Expand Up @@ -5281,6 +5317,10 @@
"enableAnalyticalStorage": {
"description": "Flag to indicate whether to enable storage analytics.",
"type": "boolean"
},
"cors": {
"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
},
"required": [
Expand Down Expand Up @@ -5397,6 +5437,10 @@
"enableAnalyticalStorage": {
"description": "Flag to indicate whether to enable storage analytics.",
"type": "boolean"
},
"cors": {
"description": "The CORS policy for the Cosmos DB database account.",
"$ref": "#/definitions/CorsPolicy"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"apiProperties": {
"serverVersion": "3.2"
},
"enableAnalyticalStorage": true
"enableAnalyticalStorage": true,
"cors": {
"allowedOrigins": "https://test"
}
}
}
},
Expand Down Expand Up @@ -141,7 +144,10 @@
"apiProperties": {
"serverVersion": "3.2"
},
"enableAnalyticalStorage": true
"enableAnalyticalStorage": true,
"cors": {
"allowedOrigins": "https://test"
}
}
}
}
Expand Down