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

CLOUDP-283086: POC validator with custom function #287

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lovisaberggren
Copy link
Collaborator

Proposed changes

Jira ticket: CLOUDP-#

Closes #[issue number]

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works

Changes to Spectral

  • I have read the README file for Spectral Updates

Further comments

@lovisaberggren
Copy link
Collaborator Author

Error output with new changes:

 34345:105  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/jwks
  34564:43  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/access
  35242:44  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/apiKeys
  37334:82  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/download
  37382:81  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restore
  37804:75  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin
  38146:90  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping
  38253:90  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/managedNamespaces
  38374:65  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/index
  39082:76  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restartPrimaries
  40505:59  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/tenantUpgrade
  40544:71  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/clusters/tenantUpgradeToServerless
  42509:72  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/flexClusters/{name}/backup/download
  43798:77  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}/cutover
  43991:64  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/maintenanceWindow/autoDefer
  44014:60  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/maintenanceWindow/defer
  44061:58  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/managedSlowMs/disable
  44085:57  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/managedSlowMs/enable
  44637:67  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/pause
  44674:68  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/resume
  44851:69  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/trigger
  45181:68  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/privateEndpoint/endpointService
  47356:74  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/serviceAccounts/{clientId}/accessList
  47481:71  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/serviceAccounts/{clientId}/secrets
  48514:66  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections
  48683:42  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/teams
  48903:62  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/userSecurity/customerX509
  48929:70  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/userSecurity/ldap/userToDNMapping
  49138:57  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/groups/{groupId}/users/{userId}/roles
  50544:58  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/orgs/{orgId}/liveMigrations/linkTokens
  51061:70  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/orgs/{orgId}/serviceAccounts/{clientId}/accessList
  51222:67  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/orgs/{orgId}/serviceAccounts/{clientId}/secrets
  51565:53  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/orgs/{orgId}/teams/{teamId}/users
  52025:53  error  xgen-IPA-104-resource-has-GET  APIs must provide a get method for resources. http://go/ipa/117  paths./api/atlas/v2/orgs/{orgId}/users/{userId}/roles

.PHONY: deps
deps: ## Download go module dependencies
@echo "==> Installing npx..."
npm install -g npx
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you gonan use npm can you move to a package json instead of a make file, also postman has a package json, let's please have a single package json and not multiple ones

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, was copying the existing spectral makefile for now. Do you mean having the same package json for postman + ipa tool?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean having the same package json for postman + ipa tool?

Yes a single source for dependencies in the repo, ie a mono repo approach

xgen-IPA-104-resource-has-GET:
description: "APIs must provide a get method for resources. http://go/ipa/104"
message: "{{error}} http://go/ipa/117"
severity: error
Copy link
Collaborator

Choose a reason for hiding this comment

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

warning :P

@@ -0,0 +1,95 @@
const ERROR_MESSAGE = "APIs must provide a get method for resources."

export default (input, _, context) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we document what version of ES can we use?

Comment on lines 33 to 39
function isChild(path) {
return path.endsWith("}")
}

function isCustomMethod(path) {
return path.includes(":")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can these be defined in a separate file and imported here, I may answer one of @drinkbird questions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely, I expect we'll have a bunch of common helper functions we can import for different custom functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants