Skip to content

extended enum support

Compare
Choose a tag to compare
@veith veith released this 17 May 06:55
· 29 commits to main since this release
8e0cac9

In this release we have extended the enum support for furo extensively.

features

  • protoc-gen-furo-muspecs can import enums
  • muSpecs with enum support
  • furo muSpec2Spec with enum transformation
  • furo spec2muSpec with enum transformation
  • furo genMessageProto with enum transformation
  • furo genEsModule with enum transformation

Since js does not have a enum representation built in to the language furo genEsModule will produce a optionlist on the usage of the enum type, which can be bound to a select field.

- enum: 'experiment.Enum #Description for a enum sample with aliases'
  values:
    UNKNOWN: 0
    STARTED: 1
    RUNNING: 1
    COMPLETE: 2
  target: enums.proto
  alias: true # this is needed when you want to allow aliases

The produced optionlist will look like this:

{
	"enum": {
		"type": "experiment.Enum",
		"meta": {
			"default": "",
			"placeholder": "experiment.experiment.enum.placeholder",
			"hint": "",
			"label": "experiment.experiment.enum.label",
			"options": {
				"flags": ["enum"],
				"list": [{
					"@type": "type.googleapis.com/furo.Optionitem",
					"display_name": "enum.experiment.enum.unknown.label",
					"id": 0,
					"selected": false
				}, {
					"@type": "type.googleapis.com/furo.Optionitem",
					"display_name": "enum.experiment.enum.started.label",
					"id": 1,
					"selected": false
				}, {
					"@type": "type.googleapis.com/furo.Optionitem",
					"display_name": "enum.experiment.enum.running.label",
					"id": 1,
					"selected": false
				}, {
					"@type": "type.googleapis.com/furo.Optionitem",
					"display_name": "enum.experiment.enum.complete.label",
					"id": 2,
					"selected": false
				}]
			},
			"readonly": false,
			"repeated": false,
			"typespecific": null
		},
		"constraints": {},
		"__proto": {
			"number": 32
		}
	}
}

fixes

  • fix: muspec2Spec constraint "required" gets overwritten if default was changed
  • fix: default constraint message key with proper key
  • fix: set correct targetfile in muspec