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

paperclip-macros patch version 0.6.4 introduced a breaking change with min/max #542

Closed
Sufflope opened this issue Sep 19, 2024 · 1 comment · Fixed by #546
Closed

paperclip-macros patch version 0.6.4 introduced a breaking change with min/max #542

Sufflope opened this issue Sep 19, 2024 · 1 comment · Fixed by #546

Comments

@Sufflope
Copy link
Contributor

Sufflope commented Sep 19, 2024

This patch version changes the DefaultSchemaRaw derived struct by adding properties to it in commit 135096f.

My problem is that I have a proc-macro crate where I generate code, including a hand-written Apiv2Schema impl for the type:

impl paperclip::v2::schema::Apiv2Schema for #ident {
    fn name() -> Option<String> {
        Some(stringify!(#ident).to_string())
    }
    fn raw_schema() -> paperclip::v2::models::DefaultSchemaRaw {
        paperclip::v2::models::DefaultSchemaRaw {
            name: Self::name(),
            reference: None,
            title: None,
            description: Some(#description.to_string()),
            data_type: Some(paperclip::v2::models::DataType::String),
            format: None,
            example: Some(serde_json::json!(#example)),
            properties: ::std::collections::BTreeMap::new(),
            items: None,
            enum_: vec![],
            extra_props: None,
            required: ::std::collections::BTreeSet::new(),
        }
    }
}

The issue is that I (and I guess other paperclip users) only add a dependency to the base crate, not the macros directly, The macro crate is pulled transitively, and 0.6.4 is semver-compatible with 0.6.3, so if I run cargo update in my end project (which depends on paperclip and my internal crate) to update my dependencies for housekeeping, paperclip-macros gets updated to 0.6.4 but then my project does not compile anymore because my proc-macro crate generates incomplete DefaultSchemaRaw structs.

IDK what the course of action would be? I would say yank paperclip-macros 0.6.x for x > 3 and bump it to 0.7.0, and release patch versions of paperclip for those which need those min/max params, with a dependency to paperclip-macros 0.7?

@tiagolobocastro
Copy link
Collaborator

Ah bummer... perhaps DefaultSchemaRaw should not have been a public api with public fields..
Anyway, seems probably we should indeed yank it out, release a "fixed" 0.6.5, and then a "breaking" 0.7.0
Meanwhile I think you can run cargo update -p paperclip-macros --precise 0.6.3

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 a pull request may close this issue.

2 participants