Duplicate description on empty additionalProperties
Los mantenedores suelen responder en 2 días
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
- openapi, typescript
- Área
- documentation
Línea de trabajo
Start by generating documentation from the provided OpenAPI schema and compare the empty additionalProperties case with the cases that do not duplicate descriptions. Trace the generator's schema rendering path for additionalProperties, then verify that the description appears only once and add a regression test covering the supplied schema.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
When a property is defined as an object with additionalProperties and no properties are defined, the description is duplicated at both the top-level object and the additionalProperties level.
This does not occur in the following scenarios:
- When a description is provided at both the top level and
additionalProperties.-
Example workaround:
workaround: allOf: - $ref: '#/components/schemas/WorkAroundModel' description: WorkaroundAnd the ref:
WorkAroundModel: type: object additionalProperties: {} description: Workaround
-
This workaround forces the object to render without a additionalProperties (property name*), though it’s not ideal. We cannot omit additionalProperties due to the need for valid examples in TypeSpec.
- When
additionalPropertiescontains valid properties, the duplication does not occur.
Expected Behavior
The description should not be duplicated. The additionalProperties section should either stay empty or have a preset description explaining that the property name is user-defined.
Current Behavior
The top-level object description is duplicated at the additionalProperties level when additionalProperties is empty.
Possible Solutions
-
Create a separate
ref:- As outlined above, you can use a
refto handle the emptyadditionalPropertiesobject and providing it a description.
- As outlined above, you can use a
-
Skip
additionalProperties:- Omitting
additionalPropertiesaltogether would resolve the issue, but since we are using TypeSpec, we need the type to align for the examples. Additionally, this wouldn't be 100% accurate to the API.
- Omitting
-
Fix in the generator:
- Ideally, a fix for the doc generator should account for this.
Steps to Reproduce
Test schema:
openapi: 3.0.0
info:
title: Bug Test
description: Testing Bug
version: 0.0.0
tags:
- name: Test
paths:
/with-bug:
post:
operationId: TestBug_create
summary: With Bug
description: |-
This is to test an `additionalProperties` bug.
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/ReturnType'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WithBug'
components:
schemas:
ReturnType:
type: object
required: [test1, test2]
properties:
test1:
type: string
enum: [Yes]
test2:
type: string
enum: [Test]
WithBug:
type: object
required: [with_bug, workaround, workaround_with_bug, additional_props_without_bug]
properties:
with_bug:
type: object
additionalProperties: {}
description: Bug with additionalProperties
workaround:
allOf:
- $ref: '#/components/schemas/WorkAroundModel'
description: Workaround
workaround_with_bug:
$ref: '#/components/schemas/WorkAroundModel'
additional_props_without_bug:
type: object
additionalProperties:
type: object
properties:
test3:
type: string
enum: [Additional Prop Test]
description: Test with additional props
WorkAroundModel:
type: object
additionalProperties: {}
description: Workaround
- Generate documentation from this schema.
- Observe the duplicated descriptions.
Screenshots
Additional Context
Does not seem to render the duplicate description in a SWAGGER editor/viewer.
Environment
- Version: 3.0.2 & 4.0.1
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.1k
- Forks
- 317
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 17
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PaloAltoNetworks/docusaurus-openapi-docs
-
Send API Request drops number and boolean default values of query parametersPosiblemente ocupada @sean0407 la tomó hace 5 días. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 66/100
PaloAltoNetworks/docusaurus-openapi-docs#1654 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
PaloAltoNetworks/docusaurus-openapi-docs#1653 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
PaloAltoNetworks/docusaurus-openapi-docs#1473 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
PaloAltoNetworks/docusaurus-openapi-docs#1472 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 2 días
-
Only show one "Introduction" item with `groupPathsBy: "tagGroup"` and `categoryLinkSource: "tag"`Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
PaloAltoNetworks/docusaurus-openapi-docs#1297 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de PaloAltoNetworks/docusaurus-openapi-docs
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
polarsource/polar#15580 ·
Los mantenedores suelen responder en 1 día
-
accepted bug via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
pingdotgg/t3code#20931 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug/1-unconfirmed kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ranxianglei/billion-context#3583 ·
Los mantenedores suelen responder en 1 día