Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ testRule('xgen-IPA-104-resource-has-GET', [
'/custom:method': {
post: {},
},
'/singleton': {
get: {},
},
},
},
errors: [],
Expand Down Expand Up @@ -87,8 +84,8 @@ testRule('xgen-IPA-104-resource-has-GET', [
'/custom:method': {
post: {},
},
'/singleton': {
patch: {},
'/standardWithoutSubResource': {
get: {},
},
},
},
Expand Down Expand Up @@ -120,7 +117,7 @@ testRule('xgen-IPA-104-resource-has-GET', [
{
code: 'xgen-IPA-104-resource-has-GET',
message: 'APIs must provide a get method for resources. http://go/ipa/104',
path: ['paths', '/singleton'],
path: ['paths', '/standardWithoutSubResource'],
severity: DiagnosticSeverity.Warning,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
},
},
},
'/singleton': {
'/resource/{id}/singleton': {
get: {
responses: {
200: {
Expand Down Expand Up @@ -127,7 +127,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
},
},
},
'/arraySingleton': {
'/resource/{id}/arraySingleton': {
get: {
responses: {
200: {
Expand All @@ -142,7 +142,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
},
},
},
'/paginatedSingleton': {
'/resource/{id}/paginatedSingleton': {
get: {
responses: {
200: {
Expand Down Expand Up @@ -197,7 +197,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
'Get methods should return data for a single resource. This method returns an array or a paginated response. http://go/ipa/104',
path: [
'paths',
'/arraySingleton',
'/resource/{id}/arraySingleton',
'get',
'responses',
'200',
Expand All @@ -212,7 +212,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
'Get methods should return data for a single resource. This method returns an array or a paginated response. http://go/ipa/104',
path: [
'paths',
'/paginatedSingleton',
'/resource/{id}/paginatedSingleton',
'get',
'responses',
'200',
Expand Down Expand Up @@ -245,7 +245,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
},
},
},
'/paginatedSingleton': {
'/resource/{id}/paginatedSingleton': {
get: {
responses: {
200: {
Expand Down
22 changes: 11 additions & 11 deletions tools/spectral/ipa/__tests__/singletonHasNoId.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
name: 'valid resources',
document: {
paths: {
'/standard': {
'/resource': {
post: {},
get: {
responses: {
Expand All @@ -26,7 +26,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
},
},
},
'/standard/{exampleId}': {
'/resource/{exampleId}': {
get: {
responses: {
200: {
Expand All @@ -47,7 +47,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
patch: {},
delete: {},
},
'/singleton1': {
'/resource/{exampleId}/singleton1': {
get: {
responses: {
200: {
Expand All @@ -65,7 +65,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
},
},
},
'/singleton2': {
'/resource/{exampleId}/singleton2': {
get: {
responses: {
200: {
Expand All @@ -92,7 +92,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
name: 'invalid resources',
document: {
paths: {
'/singleton1': {
'/resource/{exampleId}/singleton1': {
get: {
responses: {
200: {
Expand All @@ -111,7 +111,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
},
},
},
'/singleton2': {
'/resource/{exampleId}/singleton2': {
get: {
responses: {
200: {
Expand All @@ -130,7 +130,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
},
},
},
'/singleton3': {
'/resource/{exampleId}/singleton3': {
get: {
responses: {
200: {
Expand Down Expand Up @@ -164,19 +164,19 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
{
code: 'xgen-IPA-113-singleton-must-not-have-id',
message: 'Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113',
path: ['paths', '/singleton1'],
path: ['paths', '/resource/{exampleId}/singleton1'],
severity: DiagnosticSeverity.Warning,
},
{
code: 'xgen-IPA-113-singleton-must-not-have-id',
message: 'Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113',
path: ['paths', '/singleton2'],
path: ['paths', '/resource/{exampleId}/singleton2'],
severity: DiagnosticSeverity.Warning,
},
{
code: 'xgen-IPA-113-singleton-must-not-have-id',
message: 'Singleton resources must not have a user-provided or system-generated ID. http://go/ipa/113',
path: ['paths', '/singleton3'],
path: ['paths', '/resource/{exampleId}/singleton3'],
severity: DiagnosticSeverity.Warning,
},
],
Expand All @@ -185,7 +185,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [
name: 'invalid resources with exceptions',
document: {
paths: {
'/singleton1': {
'/resource/{exampleId}/singleton1': {
'x-xgen-IPA-exception': {
'xgen-IPA-113-singleton-must-not-have-id': 'reason',
},
Expand Down
Loading
Loading