Skip to content

OpenAPI 3.1 update (doc, anyOf remove). Logger, DemoAdapter upd#40

Merged
gabor-lbl merged 2 commits intodoe-iri:mainfrom
juztas:openapiupd
Feb 23, 2026
Merged

OpenAPI 3.1 update (doc, anyOf remove). Logger, DemoAdapter upd#40
gabor-lbl merged 2 commits intodoe-iri:mainfrom
juztas:openapiupd

Conversation

@juztas
Copy link
Contributor

@juztas juztas commented Feb 23, 2026

  • Avoid anyOf where possible;
  • Add logger and print all log files; Allow control logger level;
  • Demo adapter: add CommandError for subprocess run. run subprocess with check=True, raise error if fails;
  • Add descriptions to all models, get rid of str | None - this produces anyOf. Make spec compliant with Johns code.
  • Facility worker (skip None values). If field str, cant assign None.
  • Remove pyhums (no need capitalize, decapitalize)

- Avoid anyOf where possible;
- Add logger and print all log files; Allow control logger level;
- Demo adapter: add CommandError for subprocess run. run subprocess with check=True, raise error if fails;
- Add descriptions to all models, get rid of str | None - this produces anyOf. Make spec compliant with Johns code.
- Facility worker (skip None values). If field str, cant assign None.
- Remove pyhums (no need capitalize, decapitalize)
gpu_cores_per_process: Annotated[int | None, Field(ge=1, description="Number of GPU cores to allocate per process")] = None
exclusive_node_use: Annotated[StrictBool, Field(description="Whether to request exclusive use of allocated nodes")] = True
memory: Annotated[int | None, Field(ge=1, description="Amount of memory to allocate in bytes")] = None
node_count: Annotated[int, Field(ge=1, description="Number of compute nodes to allocate", example=2)] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annotated vs Field - what's the rule for which one to use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on recommendations:
Use of Annotated[T, Field(...)] for constraints & metadata.
Use of int | None (or Optional[T]) only to express that the field can be null.

int | None or Optional[T] translates in OpenAPI anyOf: [integer, null]. That is not a bug. That’s the schema saying “this can be null.” And this is one of the things we want to avoid: for automated tooling and Java compliance. Field (without None or Optional) is legacy, but all automation tools/Java are not yet up to speed with 3.1

description="If set to `true` creates all its parent directories if they do not already exist",
)
"""Represents a request to create a directory."""
parent: bool = Field(default=False, description="If set to `true` creates all its parent directories if they do not already exist", example=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Field(default=False) be excluded from the call, like Optional[bool]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be strictly False or True, and not nullable. Making it optional (or None) - introduces a third state to "turn on the light bulb". Yes, No (or Maybe). That is confusing.

@gabor-lbl gabor-lbl merged commit 9d85368 into doe-iri:main Feb 23, 2026
1 check passed
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.

2 participants