-
Notifications
You must be signed in to change notification settings - Fork 6
feat(oaslint): add oaslint #371
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
base: main
Are you sure you want to change the base?
Changes from 20 commits
a143620
2cdaa1e
53d8c7a
0422636
24648b8
9a1bb96
843e7da
0fe4516
799f51e
0d63d9b
8e4df39
ed60c71
e1b5bde
3104ad0
f8e9e06
db2f31e
4db1eb6
427a979
ae6b0b1
6082d9a
82df404
20fad69
4edc142
9f6f6c2
941910d
e51d49d
d573338
72197cb
05c4c4e
cee8de3
32deef7
55f5f80
f967e1d
a94205f
a8119a6
557cec7
3ca4e9d
06e6d5c
71a10f5
abdcefb
7a51dfb
32b811e
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 |
|---|---|---|
|
|
@@ -13,6 +13,47 @@ import ( | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // LintingMode controls how linting failures affect API creation. | ||
| type LintingMode string | ||
|
|
||
| const ( | ||
| // LintingModeBlock prevents Api creation when linting fails. | ||
| LintingModeBlock LintingMode = "block" | ||
| // LintingModeWarn allows Api creation but surfaces linting issues in status. | ||
| LintingModeWarn LintingMode = "warn" | ||
| // LintingModeNone indicates that no linting is configured for this category. | ||
| LintingModeNone LintingMode = "none" | ||
| ) | ||
|
|
||
| // LintingConfig configures OAS specification linting for APIs in this category. | ||
| type LintingConfig struct { | ||
| // URL is the base URL of the external linter service. | ||
| // When set, linting is enabled for this category. | ||
| // +kubebuilder:validation:Format=uri | ||
| // +optional | ||
| URL string `json:"url,omitempty"` | ||
|
Member
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. This will probably be the same for all Categories :/
Member
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've moved to Rover-Server now, alongside the dashboard URL, as it is a different endpoint compared to API endpoint |
||
|
|
||
| // Ruleset is the name of the linter ruleset to apply. | ||
| // If set, it is passed as a query parameter to the linter API. | ||
| // +optional | ||
| Ruleset string `json:"ruleset,omitempty"` | ||
|
stefan-ctrl marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Mode controls how linting failures affect API creation. | ||
| // "block" (default) prevents Api creation on failure; "warn" allows it but surfaces issues. | ||
| // +kubebuilder:validation:Enum=block;warn;none | ||
| // +kubebuilder:default:=block | ||
| // +optional | ||
| Mode LintingMode `json:"mode,omitempty"` | ||
|
stefan-ctrl marked this conversation as resolved.
|
||
|
|
||
| // WhitelistedBasepaths is a list of API basepaths that are exempt from linting. | ||
| // APIs whose basePath matches an entry here will skip linting even when a linter URL is configured. | ||
| // Each entry must start with a leading slash. | ||
| // +optional | ||
| // +listType=set | ||
| // +kubebuilder:validation:items:Pattern=`^/` | ||
| WhitelistedBasepaths []string `json:"whitelistedBasepaths,omitempty"` | ||
| } | ||
|
|
||
| // ApiCategorySpec defines the desired state of ApiCategory | ||
| type ApiCategorySpec struct { | ||
| // LabelValue is the name of the API category in the specification. | ||
|
|
@@ -39,16 +80,12 @@ type ApiCategorySpec struct { | |
| // +kubebuilder:default:=true | ||
| MustHaveGroupPrefix bool `json:"mustHaveGroupPrefix,omitempty"` | ||
|
|
||
| // Linting configures OAS specification linting for APIs in this category. | ||
| // If set with a URL, linting is enabled for this category. | ||
| // +optional | ||
| Linting *LintingConfig `json:"linting,omitempty"` | ||
| } | ||
|
|
||
| type LintingConfig struct { | ||
| // Enabled indicates whether linting is enabled for this API category. | ||
| Enabled bool `json:"enabled,omitempty"` | ||
| // Ruleset specifies the ruleset to use for linting. | ||
| Ruleset string `json:"ruleset,omitempty"` | ||
| } | ||
|
|
||
| type AllowTeamsConfig struct { | ||
| // Categories defines the list of team categories that are allowed to use this API category. | ||
| // If empty, all team categories are allowed. | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.