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

Add simple enum support #65

Merged
merged 6 commits into from
May 2, 2022
Merged

Add simple enum support #65

merged 6 commits into from
May 2, 2022

Conversation

clux
Copy link
Member

@clux clux commented May 1, 2022

For #39 and #16.

This does not implement sum types properly, it just collects enum members for string constant enums marked as enum. The servicemonitor example now generates more accurate structs. Consider the action field as part of servicemonitor.endpoint.metrics_relabelings:

                          action:
                            default: replace
                            description: Action to perform based on regex matching.
                              Default is 'replace'
                            enum:
                            - replace
                            - keep
                            - drop
                            - hashmod
                            - labelmap
                            - labeldrop
                            - labelkeep
                            type: string

produces:

/// RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines `<metric_relabel_configs>`-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum ServiceMonitorEndpointsMetricRelabelingsAction {
    replace,
    keep,
    drop,
    hashmod,
    labelmap,
    labeldrop,
    labelkeep,
}

Naming consistency with rust will need to be addressed in a later PR.

Signed-off-by: clux <sszynrae@gmail.com>
clux added 2 commits May 1, 2022 17:02
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux changed the title WIP enum oneOf support WIP enum support May 1, 2022
@clux clux linked an issue May 2, 2022 that may be closed by this pull request
@clux clux mentioned this pull request May 2, 2022
clux added 3 commits May 2, 2022 20:04
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux changed the title WIP enum support Add simple enum support May 2, 2022
@clux clux marked this pull request as ready for review May 2, 2022 21:47
@clux clux merged commit f575ba9 into main May 2, 2022
@clux clux deleted the enum-start branch May 2, 2022 21:48
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.

handle simple enum types
1 participant