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

Seemingly unreasonable lower_snake_case case convention on component properties #121

Closed
SidneyJiang opened this issue Jan 14, 2020 · 6 comments

Comments

@SidneyJiang
Copy link

The component section the the APIdoc describes either what the request payload looks like or what the response payload looks like.

Different team defines the payload properties differently. As in our pipeline, the payload properties always follow Camel case convention.
So they look like the followings:

{
	"eventListener": "manual-listener"
}

or

{
  "name": "TekPip4",
  "type": "tekton",
  "resourceGroupId": "19c29990ffe42ce260f5a5cb64f54169",
  "toolchainId": "d7d315d7-38f2-4301-ac51-ec188e5b6475",
  "toolchainCRN": "crn:v1:staging:public:toolchain:us-south:a/0ba224679d6c697f9baee5e14ade83ac:d7d315d7-38f2-4301-ac51-ec188e5b6475::",
  "updated_at": "2020-01-03T14:52:21.122Z",
  "id": "8af11040-4388-482a-993d-520ab10d2393",
  "inputs": [
    {
      "scmSource": {
        "path": "ascode",
        "url": "https://github.com/SidneyJiang/SimleTestWithMocha.git",
        "type": "GitHub",
        "branch": "master",
        "hookId": 155859355
      },
      "type": "scm",
      "serviceInstanceId": "0c215516-82d8-4d86-a431-a444d2c58f9d",
      "pipelineDefinitionStatus": {
        "state": "updated"
      },
      "shardDefinitionId": "ba558579-e853-4fd6-8fa5-4961d79cb168"
    }
  ],
  "envProperties": [
    {
      "name": "asd",
      "value": "asdasd",
      "type": "TEXT"
    }
  ]
}

As a result, when we use validator to validate our apidoc: https://dev.console.test.cloud.ibm.com/devops/pipelines/tekton/apispec/openapi.yaml?env_id=ibm:ys1:us-south
it complains pipelineRunId, envProperties violates lower_snake_case rule.

However, I think the property is totally legit.

@dpopp07
Copy link
Member

dpopp07 commented Jan 14, 2020

@SidneyJiang We understand that different users may have different needs for case conventions, so the convention validated for is configurable. See the configuration documentation to learn how to configure the tool to use your own case convention.

@SidneyJiang
Copy link
Author

@dpopp07 I wonder if I change the configuration file, how should I serve my .validaterc file to make sure there's no issue when generating sdk(I don't know how)

@dpopp07
Copy link
Member

dpopp07 commented Jan 14, 2020

As long as the file exists in the folder you are running the command from (or in any parent folder), you should have no issues

@SidneyJiang
Copy link
Author

Also I looked at the linked you pointed me, I can't figure out how can I just turn off lower_snake_case for components . Could you also point me an example for exactly what I need?

@dpopp07
Copy link
Member

dpopp07 commented Jan 14, 2020

It looks like what you need is to set property_case_convention to [ 'error', 'lower_camel_case'].

The relevant documentation is here and an example is here.

@SidneyJiang
Copy link
Author

Thank you very much, I will close this issue

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

No branches or pull requests

2 participants