-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add examples for SQL Swagger #954
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
Changes from 2 commits
ec2f01d
bd15110
a85b308
4272eb9
0d138a4
ae9697e
9e65f71
911dae4
3f49bb2
313d42d
d1a887f
71ac7e8
fa55594
bf1c79c
0dd80d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "00000000-1111-2222-3333-444444444444", | ||
| "resourceGroupName": "sqlcrudtest-4799", | ||
| "serverName": "sqlcrudtest-6440", | ||
| "databaseName": "testdb", | ||
| "api-version": "2014-04-01", | ||
| "parameters": { | ||
| "location": "Japan East", | ||
| "properties": { | ||
| "createMode": "OnlineSecondary", | ||
| "sourceDatabaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-3782/databases/testdb" | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "201": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "202": { | ||
| "body": { | ||
| "operation": "CreateDatabaseAsCopy", | ||
| "startTime":"\/Date(1487192687795+0000)\/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "00000000-1111-2222-3333-444444444444", | ||
| "resourceGroupName": "sqlcrudtest-4799", | ||
| "serverName": "sqlcrudtest-6440", | ||
| "databaseName": "testdb", | ||
| "api-version": "2014-04-01", | ||
| "parameters": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-8931/providers/Microsoft.Sql/servers/sqlcrudtest-1932/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "databaseId": "816c5f7e-0e36-4eec-9c51-eee7a276c14c", | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "createMode": "Default", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "creationDate": "2017-02-10T01:37:18.847Z", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why you included this property with null value in the request body? The property doesn't seem to be required, and if that's correct and you remove the null properties from the request body, the errors REQUEST_VALIDATION_ERROR reported by the tool should go away: https://travis-ci.org/Azure/azure-rest-api-specs/jobs/204330240#L2507
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may or may not have taken "every parameter specified" too literally and used response bodies to generate request bodies. Removed null request parameters.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change the Max sample to specify sampleName? |
||
| "sourceDatabaseId": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:48:08.237Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-8931/providers/Microsoft.Sql/servers/sqlcrudtest-1932/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "databaseId": "816c5f7e-0e36-4eec-9c51-eee7a276c14c", | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "createMode": "Default", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "creationDate": "2017-02-10T01:37:18.847Z", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "sourceDatabaseId": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:48:08.237Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "201": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-8931/providers/Microsoft.Sql/servers/sqlcrudtest-1932/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "databaseId": "816c5f7e-0e36-4eec-9c51-eee7a276c14c", | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "createMode": "Default", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "creationDate": "2017-02-10T01:37:18.847Z", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "sourceDatabaseId": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:48:08.237Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "202": { | ||
| "body": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. body should be removed from the example is decision is not to model it in the swagger file. |
||
| "operation": "CreateLogicalDatabase", | ||
| "startTime":"\/Date(1487192687795+0000)\/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "00000000-1111-2222-3333-444444444444", | ||
| "resourceGroupName": "sqlcrudtest-4799", | ||
| "serverName": "sqlcrudtest-5961", | ||
| "databaseName": "testdb", | ||
| "api-version": "2014-04-01", | ||
| "parameters": { | ||
| "location": "Japan East" | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "201": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "202": { | ||
| "body": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. body should be removed from the example is decision is not to model it in the swagger file. |
||
| "operation": "CreateLogicalDatabase", | ||
| "startTime": "2017-02-09T17:42:13.087-08:00" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "00000000-1111-2222-3333-444444444444", | ||
| "resourceGroupName": "sqlcrudtest-4799", | ||
| "serverName": "sqlcrudtest-6440", | ||
| "databaseName": "testdb", | ||
| "api-version": "2014-04-01", | ||
| "parameters": { | ||
| "location": "Japan East", | ||
| "properties": { | ||
| "createMode": "NonReadableSecondary", | ||
| "sourceDatabaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-3782/databases/testdb" | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "201": { | ||
| "body": { | ||
| "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/databases/testdb", | ||
| "name": "testdb", | ||
| "type": "Microsoft.Sql/servers/databases", | ||
| "location": "Japan East", | ||
| "kind": "v12.0,user", | ||
| "properties": { | ||
| "edition": "Standard", | ||
| "status": "Online", | ||
| "serviceLevelObjective": "S0", | ||
| "collation": "SQL_Latin1_General_CP1_CI_AS", | ||
| "maxSizeBytes": "268435456000", | ||
| "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", | ||
| "requestedServiceObjectiveName": "S0", | ||
| "sampleName": null, | ||
| "defaultSecondaryLocation": "Japan West", | ||
| "earliestRestoreDate": "2017-02-10T01:52:52.923Z", | ||
| "elasticPoolName": null, | ||
| "containmentState": 2, | ||
| "readScale": "Disabled", | ||
| "failoverGroupId": null | ||
| } | ||
| } | ||
| }, | ||
| "202": { | ||
| "body": { | ||
| "operation": "CreateDatabaseAsCopy", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. body should be removed from the example is decision is not to model it in the swagger file. |
||
| "startTime":"\/Date(1487192687795+0000)\/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this information is not useful to the user and the decision is to not include it in the swagger file, then it should also be removed from here. Do you expect the body on this response to be removed from the service API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect it to be removed from the Service API before we go GA with what we have here. I can remove it from examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the swagger is not doing to define a body for this error code, then the body should be removed from the example https://travis-ci.org/Azure/azure-rest-api-specs/jobs/204765825#L2611
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Removed from examples.