Skip to content

Conversation

Vincent-lau
Copy link
Contributor

@Vincent-lau Vincent-lau commented Jul 5, 2024

Add new check for new parameters' default value

Note we are only checking for default of new parameters in messages
that already have default parameters.

It lacks checks for new parameters added to messages with no default
parameters, but there is no easy way to achieve that because the generator
cannot tell what is new and what is not, moreover, there are existing
messages with non-default parameters introduced in different releases.

@Vincent-lau Vincent-lau changed the title Private/shul2/check param Add new check for new parameters' default value Jul 5, 2024
@Vincent-lau Vincent-lau force-pushed the private/shul2/check-param branch from 02d0b9f to 0bc1c71 Compare July 8, 2024 09:30
checking parameters with newer releases does not work well as there are existing
parameters with new releases but no default. *)
let _ =
let new_param_has_default obj_name msg_name ps =
Copy link
Member

@minglumlu minglumlu Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the "new parameter" could be defined as the ones whose release is larger than the release of its message/call.
Initially, the parameters (may be empty) of a message don't have default value defined as they are created with the message together. After that, adding new parameters will make all parameters as versioned_params. To distinguish them, the version of the new parameters must be larger than the message itself.

Copy link
Contributor Author

@Vincent-lau Vincent-lau Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I totally agree that should be the proper way. But there are existing params that violate this way of checking, such as tunnel-create....

@Vincent-lau Vincent-lau force-pushed the private/shul2/check-param branch from 7ac6b2c to 0416e2a Compare July 12, 2024 10:35
Also move the last function to Xapi_stdext.

Signed-off-by: Vincent Liu <[email protected]>
Note we are only checking for default of new parameters in messages
that already have default parameters.

It lacks checks for new parameters added to messages with no default
parameters, but there is no easy way to achieve that because the generator
cannot tell what is new and what is not, moreover, there are existing
messages with non-default parameters introduced in different releases.

Signed-off-by: Vincent Liu <[email protected]>
@Vincent-lau Vincent-lau merged commit a91635e into xapi-project:master Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants