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

DBRP server implementation does not match swagger specification #20087

Closed
GeorgeMac opened this issue Nov 18, 2020 · 2 comments · Fixed by #20091
Closed

DBRP server implementation does not match swagger specification #20087

GeorgeMac opened this issue Nov 18, 2020 · 2 comments · Fixed by #20091
Labels

Comments

@GeorgeMac
Copy link
Contributor

See: https://docs.influxdata.com/influxdb/v2.0/api/#operation/PostDBRP

type createDBRPRequest struct {
Database string `json:"database"`
RetentionPolicy string `json:"retention_policy"`
Default bool `json:"default"`
Org string `json:"organization"`
OrganizationID influxdb.ID `json:"organization_id"`
BucketID influxdb.ID `json:"bucket_id"`
}

The API docs states:

  • org
  • orgID
  • bucketID

But we shorten organization to org, and we use camel-case in the docs / API spec.
Since the docs are the shared source of truth, we should update the implementation.

@danxmoran
Copy link
Contributor

danxmoran commented Nov 18, 2020

@GeorgeMac I've seen a few people in the community Slack posting curl examples for using this API, I'm wary about changing the implementation and breaking them. It looks like IDPE is in the same situation (swagger here, and struct here). If Swagger is just used for documentation (no codegen), I'd prefer to fix it to match the current behavior.

EDIT: Adam pointed out that we do codegen many clients from the Swagger, sigh...

@danxmoran
Copy link
Contributor

Some more data points / bugs:

  • The generated API docs show both org and orgID as both required, when (I believe) it's really one-or-the-other. Code here.
  • The DBRP model definition in the API spec is reused for the list endpoint. The model used by the implementation of that endpoint matches the implementation of the create endpoint, so the mismatch occurs there as well:

    influxdb/dbrp_mapping.go

    Lines 28 to 38 in d93560f

    type DBRPMappingV2 struct {
    ID ID `json:"id"`
    Database string `json:"database"`
    RetentionPolicy string `json:"retention_policy"`
    // Default indicates if this mapping is the default for the cluster and database.
    Default bool `json:"default"`
    OrganizationID ID `json:"organization_id"`
    BucketID ID `json:"bucket_id"`
    }

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

Successfully merging a pull request may close this issue.

2 participants