Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
fix(nodes): use validators to prevent wrong inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiggi33 committed Aug 4, 2024
1 parent df0086f commit 2ae4958
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/provider/nodes_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"time"

"github.com/Luiggi33/pterodactyl-client-go"
"github.com/hashicorp/terraform-plugin-framework-validators/int32validator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)

Expand Down Expand Up @@ -70,6 +72,9 @@ func (d *nodesDataSource) Schema(ctx context.Context, req datasource.SchemaReque
"location_id": schema.Int32Attribute{
Description: "The ID of the location.",
Optional: true,
Validators: []validator.Int32{
int32validator.AtLeast(1),
},
},
"nodes": schema.ListNestedAttribute{
Description: "The list of nodes.",
Expand Down

0 comments on commit 2ae4958

Please sign in to comment.