Skip to content
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

ngen.cal Objective Enum needs type constraints #31

Closed
aaraney opened this issue Nov 2, 2022 · 0 comments · Fixed by #34
Closed

ngen.cal Objective Enum needs type constraints #31

aaraney opened this issue Nov 2, 2022 · 0 comments · Fixed by #34

Comments

@aaraney
Copy link
Member

aaraney commented Nov 2, 2022

class Objective(Enum):

This enum should be a class Objective(str, Enum).

When Objective is used as a type in the Estimation pydantic model, the resulting json_schema does not qualify that that the objective field is constrained to string types.

  "definitions": {
    // ...
    "Objective": {
      "title": "Objective",
      "description": "Enumeration of supported search algorithms\n\n    ",
      // missing "type": "string",
      "enum": [
        "custom",
        "kling_gupta",
        "nnse",
        "single_peak",
        "volume"
      ]
    },
    "Estimation": {
      "title": "Estimation",
      "description": "Estimation strategy for defining parameter estimation",
      "type": "object",
      "properties": {
        // ...
        "objective": {
          "title": "Objective",
          "default": "custom",
          "anyOf": [
            {
              "$ref": "#/definitions/Objective"
            },
            // ...
          ]
        },
    // ...
aaraney added a commit to aaraney/ngen-cal that referenced this issue Nov 2, 2022
aaraney added a commit to aaraney/ngen-cal that referenced this issue Nov 14, 2022
robertbartel pushed a commit to robertbartel/ngen-cal that referenced this issue Mar 31, 2023
aaraney added a commit to aaraney/ngen-cal that referenced this issue Apr 4, 2023
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 a pull request may close this issue.

1 participant