Skip to content

Commit

Permalink
Merge pull request #1 from crenshaw-dev/codegen
Browse files Browse the repository at this point in the history
fix: pointers to param values
  • Loading branch information
schakrad authored Jan 27, 2023
2 parents 1526c11 + af97bd2 commit d333acd
Show file tree
Hide file tree
Showing 10 changed files with 1,401 additions and 890 deletions.
36 changes: 26 additions & 10 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6118,18 +6118,10 @@
"type": "object",
"properties": {
"array": {
"description": "Array is the value of an array type parameter.",
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/v1alpha1OptionalArray"
},
"map": {
"description": "Map is the value of a map type parameter.",
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/v1alpha1OptionalMap"
},
"name": {
"description": "Name is the name identifying a parameter.",
Expand Down Expand Up @@ -7054,6 +7046,30 @@
}
}
},
"v1alpha1OptionalArray": {
"type": "object",
"properties": {
"array": {
"type": "array",
"title": "Array is the value of an array type parameter.\n+optional",
"items": {
"type": "string"
}
}
}
},
"v1alpha1OptionalMap": {
"type": "object",
"properties": {
"map": {
"type": "object",
"title": "Map is the value of a map type parameter.\n+optional",
"additionalProperties": {
"type": "string"
}
}
}
},
"v1alpha1OrphanedResourceKey": {
"type": "object",
"title": "OrphanedResourceKey is a reference to a resource to be ignored from",
Expand Down
7 changes: 3 additions & 4 deletions hack/generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ done
# collect_swagger gathers swagger files into a subdirectory
collect_swagger() {
SWAGGER_ROOT="$1"
EXPECTED_COLLISIONS="$2"
SWAGGER_OUT="${PROJECT_ROOT}/assets/swagger.json"
PRIMARY_SWAGGER=$(mktemp)
COMBINED_SWAGGER=$(mktemp)
Expand All @@ -112,7 +111,7 @@ EOF

rm -f "${SWAGGER_OUT}"

find "${SWAGGER_ROOT}" -name '*.swagger.json' -exec swagger mixin -c "${EXPECTED_COLLISIONS}" "${PRIMARY_SWAGGER}" '{}' \+ > "${COMBINED_SWAGGER}"
find "${SWAGGER_ROOT}" -name '*.swagger.json' -exec swagger mixin --ignore-conflicts "${PRIMARY_SWAGGER}" '{}' \+ > "${COMBINED_SWAGGER}"
jq -r 'del(.definitions[].properties[]? | select(."$ref"!=null and .description!=null).description) | del(.definitions[].properties[]? | select(."$ref"!=null and .title!=null).title)' "${COMBINED_SWAGGER}" > "${SWAGGER_OUT}"

/bin/rm "${PRIMARY_SWAGGER}" "${COMBINED_SWAGGER}"
Expand All @@ -125,9 +124,9 @@ clean_swagger() {
}

echo "If additional types are added, the number of expected collisions may need to be increased"
EXPECTED_COLLISION_COUNT=95
collect_swagger server ${EXPECTED_COLLISION_COUNT}
collect_swagger server
clean_swagger server
clean_swagger reposerver
clean_swagger controller
clean_swagger cmpserver

2 changes: 1 addition & 1 deletion pkg/apis/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/ap
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSourceJsonnet,ExtVars
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSourceJsonnet,Libs
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSourceJsonnet,TLAs
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSourcePluginParameter,Array
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSpec,IgnoreDifferences
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationSpec,Info
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,ApplicationStatus,Conditions
Expand All @@ -47,6 +46,7 @@ API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/ap
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,MergeGenerator,MergeKeys
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,NestedMergeGenerator,MergeKeys
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,Operation,Info
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,OptionalArray,Array
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,OrphanedResourcesMonitorSettings,Ignore
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,OverrideIgnoreDiff,JQPathExpressions
API rule violation: list_type_missing,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,OverrideIgnoreDiff,JSONPointers
Expand Down
Loading

0 comments on commit d333acd

Please sign in to comment.