daisy / pipeline-webui

A Web User Interface for the DAISY Pipeline 2
Other
3 stars 2 forks source link

When option gets dropdown list and default value is empty string, value description is passed instead #138

Closed bertfrees closed 2 years ago

bertfrees commented 3 years ago

For instance, the "braille-code" option of the html-to-pef script is defined by the following data type. When the value is left to the default, "-" will be passed to the Pipeline server instead of "". My current workaround is to change the first value of the data type to " " (<value> </value>). That works fine.

<choice>
  <value/>
  <documentation xmlns="http://relaxng.org/ns/compatibility/annotations/1.0">-</documentation>
  <value>(liblouis-table:"afr-za-g2.ctb")</value>
  <documentation xmlns="http://relaxng.org/ns/compatibility/annotations/1.0">Afrikaans, contracted</documentation>
  <value>(liblouis-table:"afr-za-g1.ctb")</value>
  <documentation xmlns="http://relaxng.org/ns/compatibility/annotations/1.0">Afrikaans, uncontracted</documentation>
  ...
</choice>

@josteinaj I'm not sure where to look for this bug. Got a pointer?

josteinaj commented 3 years ago

I think maybe there needs to be a null check here:

https://github.com/daisy/pipeline-clientlib-java/blob/master/clientlib-java/src/main/java/org/daisy/pipeline/client/models/datatypes/EnumType.java#L32

if (value.name == null) {
    value.name = "";
}

Maybe it would work with <value></value> in the datatype? It would probably give a text node, as opposed to <value/>. To prevent editors from closing the tag, maybe try: <value><![CDATA[]]></value>.

bertfrees commented 3 years ago

Thanks!

bertfrees commented 2 years ago

if (value.name == null) {
    value.name = "";
}

This worked!

bertfrees commented 2 years ago

Fixed by https://github.com/daisy/pipeline-clientlib-java/pull/24