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

Make lapidary work without generated model #42

Open
rafalkrupinski opened this issue Jan 5, 2023 · 0 comments
Open

Make lapidary work without generated model #42

rafalkrupinski opened this issue Jan 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@rafalkrupinski
Copy link
Contributor

rafalkrupinski commented Jan 5, 2023

Having generated model classes and method stubs is great but it should be optional.

Stubs are optional by design, they're only used by development tools. [no more stubs]

Once Lapidary validate models directly against the schema (#38) it should be possible to accept any model, e.q. a class instance, named tuple or plan dict. [not planning validation]

in case of class instances and perhaps named tuples, serialization to JSON might require consulting the openapi document to check for custom names (using x-lapidary-name).
Skipping support for dict would simplify the code, as it would require support for just a single interface (hasattr/getattr).

Response bodies could be returned as a simple named tuples, as they are fast, read-only and we don't use inheritance.

TODO: check if it's OK with mypy to have one type (class) in .pyi and another (NamedTuple) returned at run-time.

Using model types is convenience, but lapidary should support sending and receiving simple dictsin case of json content type.

@rafalkrupinski rafalkrupinski added the enhancement New feature or request label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant