Browse Source

Merge pull request #15655 from dashevchenko/arraySchemaImpr

[OpenApi] Fixed openapi descriptions for arrays
pull/15669/head
Viacheslav Klimov 4 months ago
committed by GitHub
parent
commit
ec834819b3
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java
  2. 12
      common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java
  3. 14
      common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeysV2.java
  4. 3
      common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/WidgetsBundleExportData.java

10
common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java

@ -25,12 +25,10 @@ import java.util.List;
public record TbUserMessage( public record TbUserMessage(
@NotEmpty @NotEmpty
@Valid @Valid
@ArraySchema( @Schema(
arraySchema = @Schema( requiredMode = Schema.RequiredMode.REQUIRED,
requiredMode = Schema.RequiredMode.REQUIRED, description = "A list of content parts that make up the complete user prompt"
description = "A list of content parts that make up the complete user prompt"
),
schema = @Schema(ref = "#/components/schemas/TbContent")
) )
@ArraySchema(schema = @Schema(ref = "#/components/schemas/TbContent"))
List<TbContent> contents List<TbContent> contents
) {} ) {}

12
common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java

@ -37,17 +37,21 @@ public record AvailableEntityKeys(
) )
Set<EntityType> entityTypes, Set<EntityType> entityTypes,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) @Schema(
requiredMode = Schema.RequiredMode.REQUIRED,
description = "List of unique time series key names available on the matched entities."
)
@ArraySchema( @ArraySchema(
arraySchema = @Schema(description = "List of unique time series key names available on the matched entities."),
schema = @Schema(implementation = String.class, example = "temperature"), schema = @Schema(implementation = String.class, example = "temperature"),
uniqueItems = true uniqueItems = true
) )
List<String> timeseries, List<String> timeseries,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) @Schema(
requiredMode = Schema.RequiredMode.REQUIRED,
description = "List of unique attribute key names available on the matched entities."
)
@ArraySchema( @ArraySchema(
arraySchema = @Schema(description = "List of unique attribute key names available on the matched entities."),
schema = @Schema(implementation = String.class, example = "serialNumber"), schema = @Schema(implementation = String.class, example = "serialNumber"),
uniqueItems = true uniqueItems = true
) )

14
common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeysV2.java

@ -41,15 +41,13 @@ public record AvailableEntityKeysV2(
) )
Set<EntityType> entityTypes, Set<EntityType> entityTypes,
@ArraySchema( @Schema(
arraySchema = @Schema( description = """
description = """ List of unique time series keys available on the matched entities, sorted alphabetically.
List of unique time series keys available on the matched entities, sorted alphabetically. Omitted when timeseries keys were not requested.""",
Omitted when timeseries keys were not requested.""", nullable = true
nullable = true
),
schema = @Schema(implementation = KeyInfo.class)
) )
@ArraySchema(schema = @Schema(implementation = KeyInfo.class))
@Nullable List<KeyInfo> timeseries, @Nullable List<KeyInfo> timeseries,
@Schema( @Schema(

3
common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/WidgetsBundleExportData.java

@ -36,7 +36,8 @@ public class WidgetsBundleExportData extends EntityExportData<WidgetsBundle> {
@Override @Override
public EntityType getEntityType() { return EntityType.WIDGETS_BUNDLE; } public EntityType getEntityType() { return EntityType.WIDGETS_BUNDLE; }
@ArraySchema(arraySchema = @Schema(description = "List of widgets in the bundle"), schema = @Schema(implementation = JsonNode.class)) @Schema(description = "List of widgets in the bundle")
@ArraySchema(schema = @Schema(implementation = JsonNode.class))
@JsonProperty(index = 3) @JsonProperty(index = 3)
private List<ObjectNode> widgets; private List<ObjectNode> widgets;

Loading…
Cancel
Save