-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
InfluxDB 2.0: The "View" doesn't have defined all types of "ViewProperties" [area/api] #12972
Comments
I think
But I'm not sure if the unique fields for several of these types are correctly reflected in our swagger. I'm going through each and figuring out what's missing, |
I agree. The best approach will be split View:
properties:
links:
type: object
readOnly: true
properties:
self:
type: string
id:
readOnly: true
type: string
name:
type: string
properties:
oneOf:
- $ref: "#/components/schemas/LinePlusSingleStatProperties"
- $ref: "#/components/schemas/XYViewProperties"
- $ref: "#/components/schemas/SingleStatViewProperties"
- $ref: "#/components/schemas/HistogramViewProperties"
- $ref: "#/components/schemas/GaugeViewProperties"
- $ref: "#/components/schemas/TableViewProperties"
- $ref: "#/components/schemas/MarkdownViewProperties"
- $ref: "#/components/schemas/LogViewProperties"
- $ref: "#/components/schemas/EmptyViewProperties" |
The changed "swagger" doesn't respect implementation. The unmarshalling of view properties depends on func UnmarshalViewPropertiesJSON(b []byte) (ViewProperties, error) {
var v struct {
B json.RawMessage `json:"properties"`
}
if err := json.Unmarshal(b, &v); err != nil {
return nil, err
}
if len(v.B) == 0 {
// Then there wasn't any visualization field, so there's no need unmarshal it
return EmptyViewProperties{}, nil
}
var t struct {
Shape string `json:"shape"`
Type string `json:"type"`
}
if err := json.Unmarshal(v.B, &t); err != nil {
return nil, err
}
var vis ViewProperties
switch t.Shape {
case "chronograf-v2":
switch t.Type {
case "xy":
var xyv XYViewProperties
if err := json.Unmarshal(v.B, &xyv); err != nil {
return nil, err
}
vis = xyv
case "single-stat":
var ssv SingleStatViewProperties
if err := json.Unmarshal(v.B, &ssv); err != nil {
return nil, err
}
vis = ssv
case "gauge":
var gv GaugeViewProperties
if err := json.Unmarshal(v.B, &gv); err != nil {
return nil, err
}
... but |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions. |
The
View
is defined asbut there are missing
MarkdownViewProperties
,TableViewProperties
,XYViewProperties
, ... that are defined in sources:For example the
MarkdownViewProperties
should be defined as:The text was updated successfully, but these errors were encountered: