-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using openapi schema and openapi-generator (#2)
* update repo * add package * add supporting files * update build test lint job * update golang ci config * add golangci-lint config * format files * add format job * add -d flag
- Loading branch information
1 parent
4c272c1
commit e11928f
Showing
43 changed files
with
7,433 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
output: | ||
show-stats: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[tools] | ||
just = "latest" | ||
go = "1.22.5" | ||
golangci-lint = "latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# openslo-spec | ||
# openslo-go | ||
|
||
This repository contains generated go code for the openslo spec defined in jsonschema. | ||
This repository contains generated go code for the openslo spec defined in [thisisibrahimd/openslo](https://github.com/thisisbrahimd/openslo). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module github.com/thisisibrahimd/openslo-spec | ||
|
||
go 1.22.4 | ||
go 1.22.5 | ||
|
||
require gopkg.in/validator.v2 v2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= | ||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= | ||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= | ||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= | ||
gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= | ||
gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
openslo_spec_dir := "pkg/openslo" | ||
openslo_schema_dir := "openslo/schemas" | ||
openapi_schema_url := "https://raw.githubusercontent.com/thisisibrahimd/OpenSLO/feature/add-budget-adjustment-spec/schemas/v1/schema.yaml" | ||
|
||
gen: gen-v1-spec | ||
|
||
gen-v1-spec: | ||
mkdir -p {{ openslo_spec_dir }}/v1 | ||
quicktype --quiet --telemetry disable --field-tags yaml,json --omit-empty -l go -s schema -o {{ openslo_spec_dir }}/v1/openslo_v1.go --package openslo_v1 \ | ||
{{ openslo_schema_dir }}/v1/alertcondition.schema.json \ | ||
{{ openslo_schema_dir }}/v1/alertnotificationtarget.schema.json \ | ||
{{ openslo_schema_dir }}/v1/alertpolicy.schema.json \ | ||
{{ openslo_schema_dir }}/v1/budgetadjustment.schema.json \ | ||
{{ openslo_schema_dir }}/v1/datasource.schema.json \ | ||
{{ openslo_schema_dir }}/v1/service.schema.json \ | ||
{{ openslo_schema_dir }}/v1/sli.schema.json \ | ||
{{ openslo_schema_dir }}/v1/slo.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/alertcondition-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/alertnotificationtarget-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/alertpolicy-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/budgetadjustment-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/datasource-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/description.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/duration-shorthand.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/general.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/metadata.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/metricsource.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/name.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/service-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/sli-spec.schema.json \ | ||
-S {{ openslo_schema_dir }}/v1/parts/slo-spec.schema.json | ||
GO_POST_PROCESS_FILE="$(which gofmt) -w" openapi-generator \ | ||
generate \ | ||
-i {{ openapi_schema_url }} \ | ||
-g go \ | ||
-o {{ openslo_spec_dir }}/v1 \ | ||
--inline-schema-name-mappings AlertPolicyCondition_inner=AlertPolicyCondition,AlertPolicyNotificationTarget_inner=AlertPolicyNotificationTarget \ | ||
--global-property models,modelDocs=false,supportingFiles \ | ||
--package-name openslo_v1 \ | ||
--model-package openslo_v1 \ | ||
--enable-post-process-file | ||
rm {{ openslo_spec_dir }}/v1/.openapi-generator/VERSION {{ openslo_spec_dir }}/v1/.openapi-generator/FILES | ||
rmdir {{ openslo_spec_dir }}/v1/.openapi-generator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
api/openapi.yaml | ||
README.md | ||
git_push.sh | ||
.gitignore | ||
configuration.go | ||
client.go | ||
response.go | ||
go.mod | ||
go.sum | ||
.travis.yml | ||
*/VERSION | ||
*/FILES |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.