OpenAPITools / OpenAPITools/openapi-diff
Using a reference in items of array results in error
- Langage dominant
- Java
- Étoiles
- 1.1k
- Forks
- 190
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When a reference is used in items: of an array, e.g. :
type: object
description: Model for response from call to GET products requiring an array of products to be returned.
title: GetProductResponse
properties:
Products:
type: array
items:
$ref: Product.yaml
and error is thrown while resolving the references:
$ java -jar openapi-diff-cli-2.1.0-beta.4-all.jar --error --fail-on-incompatible source/specification/openapi.yaml destination/specification/openapi.yaml
Unexpected exception. Reason: Invalid ref: ./common/models/Product.yaml
java.lang.IllegalArgumentException: Invalid ref: ./common/models/Product.yaml
at org.openapitools.openapidiff.core.utils.RefPointer.getRefName(RefPointer.java:60)
at org.openapitools.openapidiff.core.utils.RefPointer.resolveRef(RefPointer.java:16)
at org.openapitools.openapidiff.core.compare.SchemaDiff.computeDiffForReal(SchemaDiff.java:337)
at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.processSchemaQueue(DeferredSchemaCache.java:86)
at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.process(DeferredSchemaCache.java:64)
at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:100)
at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:64)
at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:102)
at org.openapitools.openapidiff.core.OpenApiCompare.fromLocations(OpenApiCompare.java:91)
at org.openapitools.openapidiff.cli.Main.main(Main.java:175)
Files GetProductResponse.yaml and Product.yaml both reside in the same directory.
Attachment contains the source and destination folders, which contain a copy of the same openapi spec.
example.zip
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’example.zip joint et reproduisez la commande CLI ; lisez ensuite RefPointer.java, en particulier getRefName et resolveRef, ainsi que le chemin d’appel de SchemaDiff et DeferredSchemaCache indiqué dans la trace. C’est terminé lorsque le $ref vers le fichier frère de l’élément du tableau est résolu sans l’exception Invalid ref et que la comparaison se termine.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 20/100