Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic *usage* documentation #67

Open
fonsp opened this issue Nov 23, 2021 · 2 comments
Open

Automatic *usage* documentation #67

fonsp opened this issue Nov 23, 2021 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@fonsp
Copy link
Contributor

fonsp commented Nov 23, 2021

Configrations.jl makes it really for me, as a package author, to add the following to my package:

  • Passing configurations through my progra
  • Reading configurations from a TOML file
  • Accepting configurations from keyword arguments

I get all of this with almost zero work, the only thing I do is specify the 'schema' of my configurations! Awesome!!

What is still missing, and what could also be given for free, is:

  1. Documentation for users of my package on how to configure my program
  2. List of possible keyword arguments
  3. Schema of the TOML file
  4. Example TOML file demonstrating possible options, already filled in with default values

I.e. I have written the schema of my configuration, but I still need to explain to my users how to write a TOML file and/or what the possible keywords are. The documentation of Configurations.jl is only targeted to me (package author), it is too technical for my users.


It would be great if there was some unified documentation on how to use a package that is configured using Configurations.jl. Even better would be if this were automatically generated, like in my ideas above!

@fonsp
Copy link
Contributor Author

fonsp commented Nov 23, 2021

@Roger-luo
Copy link
Owner

Hi @fonsp thanks for the feedback, this is very helpful!

Documentation for users of my package on how to configure my program

I thought about this before, and yes, if we look at other similar packages in other languages, they can generate a standard schema specification such as OpenAPI or JSON schema which can be further rendered as HTML documentations, is this something you would like to have?

List of possible keyword arguments

Currently we only report this when user input a wrong keyword arguments, I'm not sure about where to list the keyword arguments, you mean some kind of Documenter plugin? can you elaborate about this?

Schema of the TOML file

there are some standards for JSON schema and seems to be widely adopted (as well as OpenAPI with YAML), but I'm not sure about TOML, I searched about bit but only found toml-lang/toml#792 thus I'm not sure what format should we generate to?

Example TOML file demonstrating possible options, already filled in with default values

I think for those already with default values, this is fairly easy (just use include_defaults=true on the object with default values), but for optional fields, in Julia we use nothing as default value, and in TOML we are expected to not specify that field, so we need to be able to generate a comment for the TOML file, e.g

[person]
name = "Roger"
# age = <int>

where field gender in Julia is like

struct Person
    name::String = "Roger"
    gender::Maybe{Int} = nothing
end

This is however limited by the TOML parser, so we probably need to write our own lowering pass to TOML to resolve this.

@Roger-luo Roger-luo added the enhancement New feature or request label Dec 1, 2021
@Roger-luo Roger-luo added this to the v1.0.0 milestone Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants