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

No difference between explicit and implicit (auto-) values of enum members #468

Closed
MisterGC opened this issue Jan 17, 2023 · 6 comments
Closed
Assignees
Labels
doc HTML documentation generator enhancement New feature or request
Milestone

Comments

@MisterGC
Copy link
Contributor

MisterGC commented Jan 17, 2023

zserio generated HTML docs contain enum values also for auto-generated/implicitly assigned enum values. This is misleading and can be confusing when talking about the enum values, because it creates the impression that schema authors have explicitly decided to assign value. But exactly the opposite is the case, schema authors use this feature with "I don't care about the actual value, but assume that zserio keeps it stable as long as the position of the element doesn't change" in mind.

Example:

enum uint8 Colors
{
  RED,
  GREEN,
  BLUE
};

Generate the HTML docu and the result will contain RED = 0, GREEN = 1 and BLUE = 2 as if the author did that explicitly.

Suggestion: Omit these values in this case, the author intended that users should not care about the actual value when studying the schema.

In case there are users who really need the value the explicit assignment could be commented `// = 1, assigned implicitly'

@MisterGC MisterGC added the doc HTML documentation generator label Jan 17, 2023
@MisterGC MisterGC changed the title HTML doc: No difference between explicit and implicit (auto-) values of enum members. No difference between explicit and implicit (auto-) values of enum members. Jan 17, 2023
@Mi-La Mi-La added the enhancement New feature or request label Jan 31, 2023
@Mi-La Mi-La added this to the 2.10 milestone Jan 31, 2023
@Mi-La Mi-La self-assigned this Jan 31, 2023
Mi-La added a commit that referenced this issue Feb 3, 2023
Hide auto-generated enum/bitmask values together with comments.
@Mi-La Mi-La closed this as completed Feb 3, 2023
@mikir
Copy link
Contributor

mikir commented Feb 17, 2023

All not defined enumeration values are shown greyed now and are hideable by clicking hiding documentation icon.

@MisterGC
Copy link
Contributor Author

Can you please exclude the values completely (see my motivation above)?

@mikir
Copy link
Contributor

mikir commented Feb 17, 2023

OK. We will reopen it.

@mikir mikir reopened this Feb 17, 2023
@Mi-La
Copy link
Contributor

Mi-La commented Feb 17, 2023

Is it ok that the only chance to find out the "implicit" values will be to generate code? The values might be useful e.g. for debugging?

@MisterGC
Copy link
Contributor Author

yes, imo it is - one extension could be an option to activate the values in the docs would be possible (false by default), but even then I would clearly indicate that they have not been assigned explicitly.

@fklebert
Copy link
Contributor

For debugging purposes people should use the debug string, which anyhow renders the symbolic name of the enum and not the underlying value.

@Mi-La Mi-La closed this as completed Mar 6, 2023
@mikir mikir changed the title No difference between explicit and implicit (auto-) values of enum members. No difference between explicit and implicit (auto-) values of enum members Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc HTML documentation generator enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants