Skip to content

feat: add allowedValues to paramters#1564

Merged
Yuan325 merged 2 commits into
enum-branchfrom
enum
Oct 21, 2025
Merged

feat: add allowedValues to paramters#1564
Yuan325 merged 2 commits into
enum-branchfrom
enum

Conversation

@Yuan325

@Yuan325 Yuan325 commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

Description


Add new allowedValues field to all parameter type. It can be used as follows (can be used in the parameter field or templateParameter field):

parameter:
    - name: tableName
       type: string
       description: table name.
       allowedValues:
            - flights_table
            - tickets_table

Here, we introduce new fields as compared to the regular parameters:

parameter name type required description
allowedValues []string true We will check input value against this. User can either provide a list of allowed values or regex string.

PR Checklist


Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #779

@github-actions

Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 changed the base branch from main to enum-branch September 25, 2025 18:46
Comment thread internal/tools/parameters.go Outdated
Comment thread internal/tools/parameters.go Outdated
Comment thread internal/tools/parameters.go Outdated
Comment thread internal/tools/parameters.go Outdated
Comment thread internal/tools/parameters.go Outdated
@Yuan325 Yuan325 force-pushed the enum branch 2 times, most recently from 4d24e8b to 7e2f878 Compare October 9, 2025 01:50
@Yuan325 Yuan325 changed the title feat: add new enum parameter type feat: add allowedValues to paramters Oct 9, 2025
@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 requested a review from averikitsch October 9, 2025 03:33
@Yuan325

Yuan325 commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

@averikitsch refactored PR to the latest design.

Comment thread internal/tools/parameters.go Outdated
@github-actions

Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 merged commit 5d1eee1 into enum-branch Oct 21, 2025
12 checks passed
@Yuan325 Yuan325 deleted the enum branch October 21, 2025 20:40
@github-actions

Copy link
Copy Markdown
Contributor

🧨 Preview deployments removed.

Yuan325 added a commit that referenced this pull request Oct 21, 2025
## Description

---
Add new `allowedValues` field to all parameter type. It can be used as
follows (can be used in the `parameter` field or `templateParameter`
field):

```
parameter:
    - name: tableName
       type: string
       description: table name.
       allowedValues:
            - flights_table
            - tickets_table
```

Here, we introduce new fields as compared to the regular parameters:
| parameter name | type | required | description |
|------------------|-----|---------|-------------|
| allowedValues | []string | true | We will check input value against
this. User can either provide a list of allowed values or regex string.
|


## PR Checklist

---
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #779
Yuan325 added a commit that referenced this pull request Oct 22, 2025
## Description

---
Add new `allowedValues` field to all parameter type. It can be used as
follows (can be used in the `parameter` field or `templateParameter`
field):

```
parameter:
    - name: tableName
       type: string
       description: table name.
       allowedValues:
            - flights_table
            - tickets_table
```

Here, we introduce new fields as compared to the regular parameters:
| parameter name | type | required | description |
|------------------|-----|---------|-------------|
| allowedValues | []string | true | We will check input value against
this. User can either provide a list of allowed values or regex string.
|


## PR Checklist

---
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mitigations for potential security risks in template parameter

3 participants