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

error or warn on non-json schema inputs #516

Open
cameronelliott opened this issue Feb 28, 2024 · 2 comments
Open

error or warn on non-json schema inputs #516

cameronelliott opened this issue Feb 28, 2024 · 2 comments

Comments

@cameronelliott
Copy link

I only get prelude output from cargo-typify with no types, from my .json

Maybe I am making a silly mistake.
xaa.json

I only get the .rs prelude output with no types on this file.

$ cargo typify -o /dev/stdout xaa.json
#![allow(clippy::redundant_closure_call)]
#![allow(clippy::needless_lifetimes)]
#![allow(clippy::match_single_binding)]
#![allow(clippy::clone_on_copy)]

use serde::{Deserialize, Serialize};
$
@ahl
Copy link
Collaborator

ahl commented Feb 28, 2024

This doesn't appear to be a json schema file. As I recall, schemars has some mechanism to infer the schema from a json object, but I'm not sure and I haven't used it myself.

@ahl
Copy link
Collaborator

ahl commented Mar 2, 2024

I'm leaving this open, but repurposing it: if we load a file that doesn't appear to be JSON schema we should error out or at least warn the user.

@ahl ahl changed the title Only prelude output from cargo-typify with no types error or warn on non-json schema inputs Mar 2, 2024
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