Skip to content

Commit 45ba30a

Browse files
committed
Add edge case in crd2jsonschema.py where anyOf can be present in additionalProperties
1 parent 06bde04 commit 45ba30a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

modules/generated/argocd.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7342,7 +7342,7 @@ in {
73427342
};
73437343
}
73447344
// {
7345-
"appprojects" = mkOption {
7345+
"appProjects" = mkOption {
73467346
description = "AppProject provides a logical grouping of applications, providing controls for: * where the apps may deploy to (cluster whitelist) * what may be deployed (repository whitelist, resource whitelist/blacklist) * who can access these applications (roles, OIDC group claims bindings) * and what they can do (RBAC policies) * automation access to these roles (JWT tokens)";
73477347
type = types.attrsOf (submoduleForDefinition "argoproj.io.v1alpha1.AppProject" "appprojects" "AppProject" "argoproj.io" "v1alpha1");
73487348
default = {};
@@ -7366,7 +7366,7 @@ in {
73667366
group = "argoproj.io";
73677367
version = "v1alpha1";
73687368
kind = "AppProject";
7369-
attrName = "appprojects";
7369+
attrName = "appProjects";
73707370
}
73717371
{
73727372
name = "applications";
@@ -7379,7 +7379,7 @@ in {
73797379

73807380
resources = {
73817381
"argoproj.io"."v1alpha1"."AppProject" =
7382-
mkAliasDefinitions options.resources."appprojects";
7382+
mkAliasDefinitions options.resources."appProjects";
73837383
"argoproj.io"."v1alpha1"."Application" =
73847384
mkAliasDefinitions options.resources."applications";
73857385
};

pkgs/generators/crd2jsonschema.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def flatten_ref(definition, key, root=True):
6464
if not root:
6565
if 'type' in definition and definition['type'] == 'object':
6666
if not 'properties' in definition:
67+
# The nix generator doesn't support anyOf
68+
if 'additionalProperties' in definition and 'anyOf' in definition['additionalProperties']:
69+
definition['additionalProperties'] = definition['additionalProperties']['anyOf'][0]
70+
6771
return definition
6872
else:
6973
schema['definitions'][key] = flatten_ref(definition, key, True)
@@ -76,6 +80,7 @@ def flatten_ref(definition, key, root=True):
7680
definition['items'] = flatten_ref(definition['items'], key, False)
7781
return definition
7882

83+
# The nix generator doesn't support anyOf
7984
elif 'anyOf' in definition:
8085
newDef = definition['anyOf'][0]
8186
newDef['description'] = definition.get('description', '')

0 commit comments

Comments
 (0)