Open windless0530 opened 1 year ago
OK, now the problem is solved by simply modifying the reference of ErrorCode to local $ref: "#/ErrorCode"
, as following:
ErrorCode:
type: integer
format: int64
description: 0 for NoError, 100 for AuthenticationFailed
Meta:
title: Meta
type: object
properties:
error_code:
$ref: "#/ErrorCode"
redirect:
title: Redirect
type: object
properties:
url:
type: string
However, another 2 questions occured.
Firstly, as Meta is refered in 2 ways:
$ref: ../../common/data/component.yml#/Meta
$ref: ../data/component.yml#/Meta
Changing ErrorCode to local reference will cause 2 'Meta's be generated, Meta and Meta_1, both in the combined openapi.yaml
file and the generated codes, eg, meta.go and meta_1.go.
Secondly, another schema Error
can only be refered remotely, as following:
Error:
title: Error
type: object
properties:
code:
type: integer
format: int64
message:
type: string
StatusBadRequest:
description: Bad Request
content:
application/json:
schema:
$ref: ./component.yml#/Error
If I modify the above reference to local $ref: "#/Error"
, error would occur.
All the above types, Error, ErrorCode, Meta, StatusBadRequest are all defined in the same yaml file. No component schema is declared in the entry yaml file, amp.yml
or common.yml
.
So could any one tell the difference between Error and ErrorCode that caused the above reference restriction?
Description
I have created some yaml files, structured like:
Both
common.yml
andamp.yml
refer toauth.yml
, which refers tocomponents.yml
. See the following for details.components.yml (Meta refers to ErrorCode):
auth.yml (oauth2_code2token response refers to Meta in components.yml):
common.yml (code2token refers to oauth2_code2token in auth.yml)
amp.yml (code2token refers to oauth2_code2token in auth.yml)
As above the only difference between
amp.yml
andcommon.yml
is the relative reference path according to their different parent directories.However, only
common.yml
can be successfully parsed and generated, while theamp.yml
would generate the following error:This really confused me, for the string "common/common/data" does not even exist in my workspace.
I haved tried the followings:
ag "common/comon/data" .
in my workspace, with no output at all.docker system prune -a
to remove all the cache, and force update the generator, tried to generate again, ending in the same error./usr/local/bin/docker-entrypoint.sh generate
in the container, ending in the same error.Now I have no idea about what happened... Could anyone help me about that?
Thanks.
openapi-generator version
7.0.1-SNAPSHOT (Using the docker image)