Skip to content

Type change of double quoted strings of booleans/integers (and other issues) #144

Closed
@MODUSCarstenScholling

Description

@MODUSCarstenScholling

Hi there,

I have a kind of an issue with a datatype change causing a schema validation error later in doxfx. I am not fully sure if this is caused by PowerShell-Yaml or the underlying dll.

The used file is a stripped reference file generated by Microsoft ALDoc (Business Central, ERP). These files are usually fed into docfx to generate online help.

$yamlText = @'
### YamlMime:BusinessCentralApplicationObject
fqName: '"Dummy"'
sourceTableType:
  internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
  name: Microsoft.Foundation.Navigate."Document Entry"
  isExternal: false
objectProperties:
- name: ApplicationArea
  value: '#All'
  promoted: false
- name: DeleteAllowed
  value: "False"
  promoted: false
- name: SourceTable
  value: "265"
  promoted: true
  xrefType:
    internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
    name: Microsoft.Foundation.Navigate."Document Entry"
    isExternal: false
methods:
- syntax:
    content: procedure SetSelectItemsMode()
  summary: >-
    Set the page in the "Select Items" Mode. This means that after the "Find" Button ist used, a item list will appear where the user can choose one or more items.

    After closing the item list page this page will also close and over the filter for the seleceted items can be retrieved through procedure "GetItemSelectionFilter()"
  name: SetSelectItemsMode
  uid: M:Page::M365_Navigate_SearchAttributes.SetSelectItemsMode
commentId: O:Page::M365 Navigate SearchAttributes
name: '"M365 Navigate SearchAttributes"'
uid: O:Page::M365_Navigate_SearchAttributes
'@;

Import-Module -Name 'powershell-yaml' -Force -Scope Local;

Write-Host 'ORIGINAL';
$yamlText;

$yaml = $yamlText | ConvertFrom-Yaml -Ordered;
$newYamlText = $yaml | ConvertTo-Yaml;

Write-Host "`n`nRESULT";
$newYamlText;

ORIGINAL ($yamlText):

### YamlMime:BusinessCentralApplicationObject
fqName: '"Dummy"'
sourceTableType:
  internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
  name: Microsoft.Foundation.Navigate."Document Entry"
  isExternal: false
objectProperties:
- name: ApplicationArea
  value: '#All'
  promoted: false
- name: DeleteAllowed
  value: "False"
  promoted: false
- name: SourceTable
  value: "265"
  promoted: true
  xrefType:
    internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
    name: Microsoft.Foundation.Navigate."Document Entry"
    isExternal: false
methods:
- syntax:
    content: procedure SetSelectItemsMode()
  summary: >-
    Set the page in the "Select Items" Mode. This means that after the "Find" Button ist used, a item list will appear where the user can choose one or more items.

    After closing the item list page this page will also close and over the filter for the seleceted items can be retrieved through procedure "GetItemSelectionFilter()"
  name: SetSelectItemsMode
  uid: M:Page::M365_Navigate_SearchAttributes.SetSelectItemsMode
commentId: O:Page::M365 Navigate SearchAttributes
name: '"M365 Navigate SearchAttributes"'
uid: O:Page::M365_Navigate_SearchAttributes

RESULT ($newYamlText)

fqName: '"Dummy"'
sourceTableType:
  internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
  name: Microsoft.Foundation.Navigate."Document Entry"
  isExternal: false
objectProperties:
- name: ApplicationArea
  value: '#All'
  promoted: false
- name: DeleteAllowed
  value: False
  promoted: false
- name: SourceTable
  value: "265"
  promoted: true
  xrefType:
    internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
    name: Microsoft.Foundation.Navigate."Document Entry"
    isExternal: false
methods:
- syntax:
    content: procedure SetSelectItemsMode()
  summary: |-
    Set the page in the "Select Items" Mode. This means that after the "Find" Button ist used, a item list will appear where the user can choose one or more items.
    After closing the item list page this page will also close and over the filter for the seleceted items can be retrieved through procedure "GetItemSelectionFilter()"
  name: SetSelectItemsMode
  uid: M:Page::M365_Navigate_SearchAttributes.SetSelectItemsMode
commentId: O:Page::M365 Navigate SearchAttributes
name: '"M365 Navigate SearchAttributes"'
uid: O:Page::M365_Navigate_SearchAttributes

RESULT WITH COMMENTS

## MISSING YamlMime
fqName: '"Dummy"'
sourceTableType:
  internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
  name: Microsoft.Foundation.Navigate."Document Entry"
  isExternal: false
objectProperties:
- name: ApplicationArea
  value: '#All'
  promoted: false
- name: DeleteAllowed
  value: False ## Now a boolean instead of a string "False"
  promoted: false
- name: SourceTable
  value: "265"
  promoted: true
  xrefType:
    internalReference: O:Table::Microsoft#Foundation#Navigate#Document_Entry
    name: Microsoft.Foundation.Navigate."Document Entry"
    isExternal: false
methods:
- syntax:
    content: procedure SetSelectItemsMode()
  summary: |- ## Was >- before
    Set the page in the "Select Items" Mode. This means that after the "Find" Button ist used, a item list will appear where the user can choose one or more items.
## Missing newline
    After closing the item list page this page will also close and over the filter for the seleceted items can be retrieved through procedure "GetItemSelectionFilter()"
  name: SetSelectItemsMode
  uid: M:Page::M365_Navigate_SearchAttributes.SetSelectItemsMode
commentId: O:Page::M365 Navigate SearchAttributes
name: '"M365 Navigate SearchAttributes"'
uid: O:Page::M365_Navigate_SearchAttributes

While I mentioned all issues I have found so far, the datatype conversion string to boolean ist the most annoying :)

What I've seen so far is, that the Node.Style is DoubleQuoted. I tried to handle it (surround with double quotes). That resulted in '"False"', single and double quoted. However, the validation was successful then.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions