Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`title` isn't propagated to types that need names

Abierto
#821 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust
Área
compilers

Línea de trabajo

Reproduce el crash con el esquema mínimo del issue; después, inspecciona typify-impl/src/type_entry.rs en la línea 365 y sigue las rutas convert_one_of, convert_array y convert_object que se muestran en el backtrace. Añade cobertura para el esquema oneOf/object/array/object con título y confirma que la generación se completa sin un unwrap panic.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

naming

Hello! Thanks for your work on this library, I've found it super useful so far.

I came upon some strange failures while attempting to generate types from a schema. After some debugging, I've worked out that typify fails when all of the following are true:

  • a schema has a top-level title
  • there exists a oneOf -> object -> array -> object structure
  • the object at the bottom of this aforementioned structure has additionalProperties: false

Oddly, removing the schema title fixes the issue. I'm surprised at the apparent incompatibility with fine-grained details deep within the schema.

I've worked out a somewhat-minimal reproduction:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "levilutz/test",
  "title": "My Title",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "myArray": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false
          }
        }
      },
      "required": ["myArray"]
    }
  ]
}

This is a valid schema according to other tools (e.g. https://www.jsonschemavalidator.net/), and validates against a simple object like:

{
  "myArray": []
}

When running the most-recent version of typify (v0.4.1) against this schema, however, I get the following error response:

The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/typify-impl-0.4.1/src/type_entry.rs:365

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮                               
   8: core::panicking::panic::h7b600627f80950c0
      at <unknown source file>:<unknown line>
   9: core::option::unwrap_failed::ha26b4e83b98d2d13
      at <unknown source file>:<unknown line>
  10: typify_impl::type_entry::TypeEntryStruct::from_metadata::hcf544dd3f0cc8c8e
      at <unknown source file>:<unknown line>
  11: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_object::h2a7082577a772472
      at <unknown source file>:<unknown line>
  12: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object::h7e4ec5c054bed7e9
      at <unknown source file>:<unknown line>
  13: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema::h7957d2868a66153d
      at <unknown source file>:<unknown line>
  14: typify_impl::TypeSpace::id_for_schema::h19fa02d922234d32
      at <unknown source file>:<unknown line>
  15: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_array::h5868e01754fabf21
      at <unknown source file>:<unknown line>
  16: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object::h7e4ec5c054bed7e9
      at <unknown source file>:<unknown line>
  17: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema::h7957d2868a66153d
      at <unknown source file>:<unknown line>
  18: typify_impl::enums::<impl typify_impl::TypeSpace>::external_variant::h48afeda86a50f916
      at <unknown source file>:<unknown line>
  19: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold::he04ab46ccb067b2f
      at <unknown source file>:<unknown line>
  20: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter::hac2897b80f5d20cc
      at <unknown source file>:<unknown line>
  21: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_one_of::h9f45cecdc21c52ca
      at <unknown source file>:<unknown line>
  22: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object::h7e4ec5c054bed7e9
      at <unknown source file>:<unknown line>
  23: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema::h7957d2868a66153d
      at <unknown source file>:<unknown line>
  24: typify_impl::TypeSpace::convert_ref_type::h819ae33afdabc3eb
      at <unknown source file>:<unknown line>
  25: typify_impl::TypeSpace::add_root_schema::h195960e39adc4593
      at <unknown source file>:<unknown line>
  26: cargo_typify::convert::hf58d8a5d11ae4f78
      at <unknown source file>:<unknown line>
  27: cargo_typify::main::hbde4a261aea08d14
      at <unknown source file>:<unknown line>
  28: std::sys::backtrace::__rust_begin_short_backtrace::h6346c08723a6acad
      at <unknown source file>:<unknown line>
  29: std::rt::lang_start::{{closure}}::h36c770c741882814
      at <unknown source file>:<unknown line>
  30: std::rt::lang_start_internal::h5e621041f01a4c14
      at <unknown source file>:<unknown line>
  31: main<unknown>
      at <unknown source file>:<unknown line>
  32: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>
  33: _start<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

I noticed this same exact LOC was referenced in #816 recently, but I do not see any parallels between the two failure cases.

Please let me know if there are any additional details I can provide. Thanks again for your work on this tool!

Lenguaje dominante
Rust
Estrellas
907
Forks
116
Merge medio
20 h 18 min
PR fusionados (30 d)
13

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oxidecomputer/typify

Todos los issues de oxidecomputer/typify

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.