Skip to content

serde_json::Value broken with latest release #455

@oscartbeaumont

Description

@oscartbeaumont

It's Type impl is recursive. This will be fixed by #454

Repro:

use std::collections::HashMap;

use serde::Serialize;
use specta::{Type, TypeCollection};
use specta_typescript::Typescript;

#[derive(Serialize, Type)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Policy {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    configurations: Option<HashMap<String, serde_json::Value>>, // TODO: Fix Specta on value type
}

fn main() {
    println!(
        "{}",
        Typescript::default()
            .export(&TypeCollection::default().register::<Policy>())
            .unwrap()
    );
}

for personal context: Found on Mattrax Policy.configurations and skipped for now.

We need better testing for custom impls!!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions