dsccommunity / DscResource.DocGenerator

Module for generation of DSC resource documentation
MIT License
9 stars 10 forks source link

Wiki generation for class-based resource puts parameters in random order #126

Closed johlju closed 2 weeks ago

johlju commented 2 years ago

Details of the scenario you tried and the problem that is occurring

Wiki generation for class-based resource puts parameters in random order. Even more when a resource derive DSC properties from parent class. I suggest the properties are grouped in the order Key, Mandatory, Write, and last Read - for each group the properties are sorted in alphabetical ascending order.

Steps to reproduce the problem

See https://github.com/dsccommunity/SqlServerDsc/wiki/SqlAudit

Expected behavior

Better order of parameters.

Current behavior

Comes in the order they are in the code, with parent class properties first, then derived class's properties.

Suggested solution to the issue

Sort the properties before writing them to mmarkdown.

The operating system the target node is running

n/a

Version and build of PowerShell the target node is running

n/a

Version of the module that was used

n/a

gaelcolas commented 2 years ago

Is there any reason why you are using AST here @johlju ? If you instead do a "using module YourDscResourceModule", then you can access [ClassDscResource] and from there access the properties and attributes...?

johlju commented 2 years ago

Well, most likely because I did not know about the other way and MOF generation was handled with AST. 😊 But we could execute a scriptblock with the alternetive you suggest that returns the necessary information. 🤔