Skip to content

Generator can not properly handle keys/values with operand characters (ie $) #307

@tyler-adam

Description

@tyler-adam

In the process of trying to create a jsonnet-lib for the Azure Service Operator v2, I discovered that they label one of their attributes $propertyBag. By doing this, the generator trips over itself. Here is an example of the output (trimmed for visibility):

66:11-12 Expected token OPERATOR but got "$": {
    <trimmed>
    '#workspaceCapping':: d.obj(help="\"Storage version of v1api20210601.WorkspaceCapping The daily volume cap for ingestion.\""),
    workspaceCapping: {
      '#with$PropertyBag':: d.fn(help="\"PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions\"", args=[d.arg(name="$propertyBag", type=d.T.object)]),
      with$PropertyBag($propertyBag): { spec+: { workspaceCapping+: { $propertyBag: $propertyBag } } },
      '#with$PropertyBagMixin':: d.fn(help="\"PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions\"\n\n**Note:** This function appends passed data to existing values", args=[d.arg(name="$propertyBag", type=d.T.object)]),
      with$PropertyBagMixin($propertyBag): { spec+: { workspaceCapping+: { $propertyBag+: $propertyBag } } },
      '#withDailyQuotaGb':: d.fn(help="", args=[d.arg(name="dailyQuotaGb", type=d.T.number)]),
      withDailyQuotaGb(dailyQuotaGb): { spec+: { workspaceCapping+: { dailyQuotaGb: dailyQuotaGb } } }
    }
  },
  '#mixin': "ignore",
  mixin: self
}
make: *** [Makefile:55: libs/azure-service-operator] Error 1

There should to be a way for k8s-gen to be aware of invalid characters and fix them however necessary (wrapping keys in quotes, etc - stripping them from variable names).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions