ti-community-infra / tichi

TiChi ☯️ contains the tidb community collaboration automation basic framework and tool set.
https://prow.tidb.net
Apache License 2.0
45 stars 27 forks source link

Use JSON Schema to make IDE support yaml lint and hint. #385

Open Mini256 opened 3 years ago

Mini256 commented 3 years ago

Feature Request

Describe the feature you'd like:

We can use JSON Schema to make IDE support yaml lint and hint, which can help us avoid some errors on IDE prompts.

Do you have any ideas on how to implement it?(Optional)

We can use jsonschema to automatically generate JSON Schema according to the Go language type definition, and then import the json file into the configuration in the IDE (Such as Goland).

config

type Configuration struct {
    TichiWebURL     string `json:"tichi_web_url,omitempty" jsonschema:"required"`
    PRProcessLink   string `json:"pr_process_link,omitempty" jsonschema:"required"`
    CommandHelpLink string `json:"command_help_link,omitempty" jsonschema:"required"`
}

json generated

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "required": [
    "tichi_web_url",
    "pr_process_link",
    "command_help_link"
  ],
  "properties": {
    "tichi_web_url": {
      "type": "string"
    },
    "pr_process_link": {
      "type": "string"
    },
    "command_help_link": {
      "type": "string"
    },
  },
  "additionalProperties": false,
  "type": "object",
  "definitions": {}
}

preview

image

image

Rustin170506 commented 3 years ago

Cool!

ti-chi-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Send feedback to sig-community-infra or Mini256. /lifecycle stale

Rustin170506 commented 3 years ago

/remove-lifecycle stale

ti-chi-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Send feedback to sig-community-infra or Mini256. /lifecycle stale

ti-chi-bot commented 2 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close. Send feedback to sig-community-infra or Mini256. /lifecycle rotten