Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 38 additions & 12 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,37 @@
- Unstructured
components:
schemas:
IEEENumber:
example: 1.0
oneOf:
- type: number
- type: string
description: Non-finite IEEE 754 floating-point values.
enum:
- 'NaN'
- 'Infinity'
- '-Infinity'
IEEEDouble:
example: 1.0
oneOf:
- type: number
format: double
- type: string
description: Non-finite IEEE 754 double precision floating-point values.

Check failure on line 1124 in openapi.yaml

View workflow job for this annotation

GitHub Actions / lintspec

1124:81 [line-length] line too long (82 > 80 characters)
enum:
- 'NaN'
- 'Infinity'
- '-Infinity'
IEEEDoubleNoNaN:
example: 1.0
oneOf:
- type: number
format: double
- type: string
description: Non-finite IEEE 754 double precision floating-point values, excluding NaN.

Check failure on line 1135 in openapi.yaml

View workflow job for this annotation

GitHub Actions / lintspec

1135:81 [line-length] line too long (97 > 80 characters)
enum:
- 'Infinity'
- '-Infinity'
GetVarLocationResponseLocation:
type: object
properties:
Expand Down Expand Up @@ -1142,8 +1173,7 @@
Doubles:
type: array
items:
type: number
format: double
$ref: '#/components/schemas/IEEEDouble'
minItems: 1
GetGridRankResponse:
type: integer
Expand All @@ -1168,13 +1198,9 @@
- type
additionalProperties: false
GetTimeResponse:
type: number
format: double
example: 0.0
$ref: '#/components/schemas/IEEEDoubleNoNaN'
GetTimeStepResponse:
type: number
format: double
example: 1.0
$ref: '#/components/schemas/IEEEDoubleNoNaN'
GetTimeUnitsResponse:
type: object
properties:
Expand All @@ -1187,12 +1213,12 @@
GetValueAtIndicesResponse:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
GetValueResponse:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
GetVarGridResponse:
type: integer
Expand Down Expand Up @@ -1258,7 +1284,7 @@
values:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
required:
- indices
Expand All @@ -1267,7 +1293,7 @@
SetValueRequest:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
Grid:
type: integer
Expand Down
50 changes: 38 additions & 12 deletions python/src/remotebmi/server/openapi.yaml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can't we use a git symlink to not have duplicate files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope see #6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What apparently can work is a custom hook for hatchling;

w/ [tool.hatch.build.hooks.custom]

python/hatch_build.py::

from pathlib import Path

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
    """Bundle the repository-wide openapi.yaml into the package."""

    def initialize(self, version, build_data):
        spec = Path(self.root).parent / "openapi.yaml"
        if not spec.exists():
            # Building from an sdist, which already contains the spec under src/
            return
        dest = "remotebmi/server/openapi.yaml"
        if self.target_name == "sdist":
            dest = f"src/{dest}"
        build_data["force_include"][str(spec)] = dest

and make_app in init.py needs:

    openapi_path = Path(__file__).parent / "openapi.yaml"
    if not openapi_path.exists():
        # Editable install, use spec from root of repository
        openapi_path = Path(__file__).parents[4] / "openapi.yaml"

But that's also not ideal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,37 @@ paths:
- Unstructured
components:
schemas:
IEEENumber:
example: 1.0
oneOf:
- type: number
- type: string
description: Non-finite IEEE 754 floating-point values.
enum:
- 'NaN'
- 'Infinity'
- '-Infinity'
IEEEDouble:
example: 1.0
oneOf:
- type: number
format: double
- type: string
description: Non-finite IEEE 754 double precision floating-point values.
enum:
- 'NaN'
- 'Infinity'
- '-Infinity'
IEEEDoubleNoNaN:
example: 1.0
oneOf:
- type: number
format: double
- type: string
description: Non-finite IEEE 754 double precision floating-point values, excluding NaN.
enum:
- 'Infinity'
- '-Infinity'
GetVarLocationResponseLocation:
type: object
properties:
Expand Down Expand Up @@ -1142,8 +1173,7 @@ components:
Doubles:
type: array
items:
type: number
format: double
$ref: '#/components/schemas/IEEEDouble'
minItems: 1
GetGridRankResponse:
type: integer
Expand All @@ -1168,13 +1198,9 @@ components:
- type
additionalProperties: false
GetTimeResponse:
type: number
format: double
example: 0.0
$ref: '#/components/schemas/IEEEDoubleNoNaN'
GetTimeStepResponse:
type: number
format: double
example: 1.0
$ref: '#/components/schemas/IEEEDoubleNoNaN'
GetTimeUnitsResponse:
type: object
properties:
Expand All @@ -1187,12 +1213,12 @@ components:
GetValueAtIndicesResponse:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
GetValueResponse:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
GetVarGridResponse:
type: integer
Expand Down Expand Up @@ -1258,7 +1284,7 @@ components:
values:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
required:
- indices
Expand All @@ -1267,7 +1293,7 @@ components:
SetValueRequest:
type: array
items:
type: number
$ref: '#/components/schemas/IEEENumber'
minItems: 1
Grid:
type: integer
Expand Down
Loading