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

How to read from string? #362

Open
luckydonald opened this issue Jun 26, 2024 · 3 comments
Open

How to read from string? #362

luckydonald opened this issue Jun 26, 2024 · 3 comments

Comments

@luckydonald
Copy link

luckydonald commented Jun 26, 2024

I couldn't find a way to read from a string, without spamming a temporary file.

from openapi_spec_validator import validate

schema_text = """{"openapi": "3.0.0"}"""

schema: Schema = ???(schema_text)

validate(schema)
@p1c2u
Copy link
Collaborator

p1c2u commented Jun 26, 2024

echo "string" | openapi-spec-validator -

@luckydonald
Copy link
Author

luckydonald commented Jun 26, 2024

Apologies, I mean from within python.

there's read_from_filename, read_from_stdin, but no read_from_str.

@p1c2u
Copy link
Collaborator

p1c2u commented Jul 2, 2024

just use json.loads?

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

No branches or pull requests

2 participants