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

feature: add managed fields in jsonschema for resources, such as create_time and update_time #2433

Closed
nic-chen opened this issue Oct 15, 2020 · 8 comments
Assignees
Labels

Comments

@nic-chen
Copy link
Member

Issue description

We are refactoring the dashboard manager api, to remove the dependency on MySQL. Previously, some managed fields were saved in mysql. After refactoring, we moved these fields to ETCD. I think APISIX's json schema should also support this part of the fields to avoid data being filtered out.

Here is the detail:

create_time and update_time for route,upstream,service,consumer,ssl
validity_start and validity_end for ssl

this four fields are all int type for Unix timestamp.

@nic-chen
Copy link
Member Author

cc @moonming @membphis @ShiningRush

@membphis
Copy link
Member

membphis commented Oct 15, 2020

@nic-chen can you provide some examples?

@nic-chen
Copy link
Member Author

@membphis

example, add create_time and update_time for service


local timestamp_def = {
    type = "integer",
}

_M.service = {
    type = "object",
    properties = {
        id = id_schema,
        plugins = plugins_schema,
        upstream = upstream_schema,
        upstream_id = id_schema,
        name = {type = "string", maxLength = 50},
        desc = {type = "string", maxLength = 256},
        script = {type = "string", minLength = 10, maxLength = 102400},
        labels = {
            description = "key/value pairs to specify attributes",
            type = "object",
            patternProperties = {
                [".*"] = label_value_def
            },
            maxProperties = 16
        },
        create_time = timestamp_def,
        update_time = timestamp_def
    },
    additionalProperties = false,
}

@membphis
Copy link
Member

@nic-chen do we need to add create_time and update_time for all object? eg: service, route and consumer etc.

@nic-chen
Copy link
Member Author

@nic-chen do we need to add create_time and update_time for all object? eg: service, route and consumer etc.

yes, i think so. if not, data will be filter by :
https://github.com/apache/apisix/blob/master/apisix/core/config_etcd.lua#L220-L226

@membphis
Copy link
Member

agree to add the new field ^_^

@dabue
Copy link
Contributor

dabue commented Oct 17, 2020 via email

@membphis
Copy link
Member

fixed alread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants