Skip to content

Commit 7c0f82d

Browse files
committed
Tag: Fix codegen when using 2.4.0 swagger-codegen
After upgrading to swagger-codegen 2.4.0, it appears that it no longer generates models that are missing a type and instead require we include type: object. Additionally, it's having trouble generating arrays of inlined objects, resulting in things like List<Object> instead of it being a List<MyModel>. The workaround is to pull out every inline object of an array into a definition. The resulting codegen is identical to what was produced by swagger-codegen 2.3.1. We're also using this opportunity to rename some of the selection API models to be more consistent, which does result in a codegen change.
1 parent e1e1f58 commit 7c0f82d

File tree

1 file changed

+80
-62
lines changed

1 file changed

+80
-62
lines changed

tag/nitag.yml

Lines changed: 80 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ responses:
4343
description: List of tags, including their current and aggregate values
4444
schema:
4545
title: Get Tags With Values Response
46+
type: object
4647
properties:
4748
totalCount:
4849
description: Total number of tags which match a given query
@@ -56,6 +57,7 @@ responses:
5657
description: List of tags, excluding current and aggregate values
5758
schema:
5859
title: Get Tags Response
60+
type: object
5961
properties:
6062
totalCount:
6163
type: integer
@@ -81,6 +83,7 @@ responses:
8183
description: List of subscription updates
8284
schema:
8385
title: V1 Get Subscription Updates Response
86+
type: object
8487
properties:
8588
subscriptionUpdates:
8689
description: Subscription updates
@@ -96,6 +99,7 @@ responses:
9699
description: List of subscription updates
97100
schema:
98101
title: V2 Get Subscription Updates Response
102+
type: object
99103
properties:
100104
subscriptionUpdates:
101105
description: Subscription updates
@@ -618,15 +622,7 @@ paths:
618622
schema:
619623
type: array
620624
items:
621-
description: Tag path with timestamped value
622-
type: object
623-
title: Tag Path With Current Value
624-
properties:
625-
path:
626-
type: string
627-
description: Tag path
628-
current:
629-
$ref: '#/definitions/TimestampedTagValue'
625+
$ref: '#/definitions/TagPathWithTimestampedValue'
630626
401:
631627
$ref: '#/responses/Unauthorized'
632628
default:
@@ -650,15 +646,7 @@ paths:
650646
schema:
651647
type: array
652648
items:
653-
description: Tag path with value
654-
type: object
655-
title: Tag Path With Value
656-
properties:
657-
path:
658-
type: string
659-
description: Tag path
660-
current:
661-
$ref: '#/definitions/TagValue'
649+
$ref: '#/definitions/TagPathWithValue'
662650
401:
663651
$ref: '#/responses/Unauthorized'
664652
default:
@@ -684,17 +672,7 @@ paths:
684672
type: array
685673
title: Tag Paths With Timestamps
686674
items:
687-
type: object
688-
title: Tag Path and Timestamp
689-
description: A tag path and the timestamp of its current value
690-
properties:
691-
timestamp:
692-
description: Timestamp associated with the current value
693-
type: string
694-
format: iso-date-time
695-
example: '2018-09-04T18:45:08Z'
696-
path:
697-
type: string
675+
$ref: '#/definitions/TagPathWithTimestamp'
698676
401:
699677
$ref: '#/responses/Unauthorized'
700678
default:
@@ -719,14 +697,7 @@ paths:
719697
description: Array of the "min" values from the aggregates for each tag in the selection.
720698
type: array
721699
items:
722-
type: object
723-
title: Tag Path with Min Aggregate
724-
properties:
725-
path:
726-
type: string
727-
min:
728-
description: Minimum value from the tag's aggregates
729-
type: string
700+
$ref: '#/definitions/TagPathWithMinAggregate'
730701
401:
731702
$ref: '#/responses/Unauthorized'
732703
default:
@@ -751,14 +722,7 @@ paths:
751722
description: Array of the "max" values from the aggregates for each tag in the selection.
752723
type: array
753724
items:
754-
type: object
755-
title: Tag Path With Max Aggregate
756-
properties:
757-
path:
758-
type: string
759-
max:
760-
description: Maximum value from the tag's aggregates
761-
type: string
725+
$ref: '#/definitions/TagPathWithMaxAggregate'
762726
401:
763727
$ref: '#/responses/Unauthorized'
764728
default:
@@ -783,15 +747,7 @@ paths:
783747
description: Array of the "avg" values from the aggregates for each tag in the selection.
784748
type: array
785749
items:
786-
type: object
787-
title: Tag Path and Mean Value
788-
properties:
789-
path:
790-
type: string
791-
avg:
792-
description: Mean value from the tag's aggregates
793-
type: number
794-
format: double
750+
$ref: '#/definitions/TagPathWithMeanAggregate'
795751
401:
796752
$ref: '#/responses/Unauthorized'
797753
default:
@@ -816,14 +772,7 @@ paths:
816772
description: Array of the "count" values from the aggregates for each tag in the selection.
817773
type: array
818774
items:
819-
type: object
820-
title: Tag Paths and Count Values
821-
properties:
822-
path:
823-
type: string
824-
count:
825-
description: Count value from the tag's aggregates
826-
type: integer
775+
$ref: '#/definitions/TagPathWithCountAggregate'
827776
401:
828777
$ref: '#/responses/Unauthorized'
829778
default:
@@ -1503,6 +1452,15 @@ definitions:
15031452
example:
15041453
type: DOUBLE
15051454
value: "3.14"
1455+
TagPathWithCountAggregate:
1456+
type: object
1457+
title: Tag Path with Count Aggregate
1458+
properties:
1459+
path:
1460+
type: string
1461+
count:
1462+
description: Count value from the tag's aggregates
1463+
type: integer
15061464
TagPathWithCurrentAndAggregateValue:
15071465
description: Tag path with its current value and aggregates
15081466
type: object
@@ -1525,6 +1483,66 @@ definitions:
15251483
max: "5.0"
15261484
avg: 2.0
15271485
count: 5
1486+
TagPathWithTimestampedValue:
1487+
description: Tag path with timestamped value
1488+
type: object
1489+
title: Tag Path with Timestamped Value
1490+
properties:
1491+
path:
1492+
type: string
1493+
description: Tag path
1494+
current:
1495+
$ref: '#/definitions/TimestampedTagValue'
1496+
TagPathWithValue:
1497+
description: Tag path with value
1498+
type: object
1499+
title: Tag Path With Value
1500+
properties:
1501+
path:
1502+
type: string
1503+
description: Tag path
1504+
current:
1505+
$ref: '#/definitions/TagValue'
1506+
TagPathWithTimestamp:
1507+
type: object
1508+
title: Tag Path with Timestamp
1509+
description: A tag path and the timestamp of its current value
1510+
properties:
1511+
timestamp:
1512+
description: Timestamp associated with the current value
1513+
type: string
1514+
format: iso-date-time
1515+
example: '2018-09-04T18:45:08Z'
1516+
path:
1517+
type: string
1518+
TagPathWithMaxAggregate:
1519+
type: object
1520+
title: Tag Path With Max Aggregate
1521+
properties:
1522+
path:
1523+
type: string
1524+
max:
1525+
description: Maximum value from the tag's aggregates
1526+
type: string
1527+
TagPathWithMinAggregate:
1528+
type: object
1529+
title: Tag Path with Min Aggregate
1530+
properties:
1531+
path:
1532+
type: string
1533+
min:
1534+
description: Minimum value from the tag's aggregates
1535+
type: string
1536+
TagPathWithMeanAggregate:
1537+
type: object
1538+
title: Tag Path with Mean Aggregate
1539+
properties:
1540+
path:
1541+
type: string
1542+
avg:
1543+
description: Mean value from the tag's aggregates
1544+
type: number
1545+
format: double
15281546
TimestampedTagValue:
15291547
description: Current value of a tag
15301548
type: object

0 commit comments

Comments
 (0)