OpenAPITools / OpenAPITools/openapi-generator
Yaml anchors (using &) and references (using *)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I have problem with using anchors (using &) and references (using *) in my Openapi file.
I have to generate a file without anchors and references , and only then there is a successful generation.
-attribute components.schemas.Board.properties is not of type `object`
-attribute paths.'/dictionaries/cities'(get).<< is unexpected
-attribute components.schemas.Payment.<< is unexpected
-attribute components.schemas.MoneyType.properties is not of type `object`
...
openapi-generator version
3.3.4
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: 'ati.su api'
version: '1.0'
servers:
- url: https://{environment}.ati.su
variables:
environment:
default: sandbox-api # Development server
enum:
- id # Production server
- sandbox-api # Development server
x-types:
- &id
type: integer
format: int64
minimum: 0
example: 1
- &ids
type: array
items: *id
- &uuid
type: string
format: uuid
- &idString
type: string
- &email
type: string
format: email
- &tube
type: number
format: float
description: >
The parameter must be specified if the street is not specified (the Street parameter is null or has a length of less than 5 characters) and at least one of the three conditions is met:
1. City is Moscow;
1. City is St. Petersburg;
1. The cities of loading and unloading are the same.
example: 50.50
- &datetime
type: string
format: date-time
example: 2016-08-11T11:40:55.063Z
- ×tamp
type: integer
format: int64
minimum: 0
description: Unix Timtestamp
- &float
type: integer
format: float
default: 0.0
- &percent
type: integer
format: int32
minimum: 0
maximum: 100
default: 0
- &count
type: integer
format: int64
minimum: 0
- &booleanTrue
type: boolean
default: true
- &booleanFalse
type: boolean
default: false
- &logic
type: string
enum: [OR, AND]
default: OR
- &trucksCount
type: integer
minimum: 1
maximum: 99
default: 1
- &temperature
type: integer
minimum: -99
maximum: 999
example: 36
- &Weight
type: integer
format: int32
minimum: 0
maximum: 9999
example: 1000
- &Volume
type: integer
format: int32
minimum: 0
maximum: 9999
description: Сubic meters
example: 50
- &ADR
type: integer
format: int32
minimum: 0
maximum: 9
description: The degree of danger of cargo
default: 0
- &Length
<<: *float
minimum: 0
maximum: 50
default: 0
- &Width
<<: *float
minimum: 0
maximum: 50
default: 0
- &Height
<<: *float
minimum: 0
maximum: 50
default: 0
- &LengthHighlight
type: boolean
default: false
- &WidthHighlight
type: boolean
default: false
- &HeightHighlight
type: boolean
default: false
- &CargoType
type: string
maxLength: 50
description: Required if CargoTypeId equal 59
example: Documents
- &PalletCount
type: integer
minimum: 0
maximum: 9999
default: 0
- &BeltCount
type: integer
minimum: 0
maximum: 9999
default: 0
- &DogruzType
type: integer
minimum: 1
maximum: 3
description: >
1. only by machine
1. single or partial load
1. only partial load
example: 1
- &SborGruz
type: boolean
default: false
- &Latitude
<<: *tube
minimum: -90
maximum: 90
- &Longitude
<<: *tube
minimum: -180
maximum: 180
- &LargeCities
type: array
description: http://api.ati.su/help/32018170.html
items:
type: integer
minItems: 1
maxItems: 10
example: [5,6,7]
- &IntegerPriorityView
description: Required if ViewRate is empty
type: string
maxLength: 5
pattern: '^\d((\.|\,)[0-9]{1,2})?$'
default: 0
- &security
security:
- OAuth2: []
paths:
/apps/{client_id}:
get:
tags:
- Auth
summary: 'Get access token'
responses:
200:
description: OK
content:
text/html:
schema:
type: string
parameters:
- name: client_id
in: path
description: 'Software token'
required: true
schema:
type: string
/account:
get:
<<: *security
tags:
- Account
summary: Получение информации об аккаунте
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
/loads:
post:
<<: *security
tags:
- Load
summary: Добавление груза
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddLoad'
responses:
200:
description: OK
# Dictionary
/dictionaries/ownerships:
get:
tags:
- Dictionary
summary: Выводит список организационно-правовых форм
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OwnerShip'
/dictionaries/regions:
get:
tags:
- Dictionary
summary: Выводит список регионов
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Region'
/dictionaries/countries:
get:
tags:
- Dictionary
summary: Выводит список стран
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Country'
/dictionaries/cargoTypes:
get:
tags:
- Dictionary
summary: Выводит список наименований грузов
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CargoType'
/dictionaries/packTypes:
get:
tags:
- Dictionary
summary: Выводит список наименований упаковок
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/PackType'
/dictionaries/cities:
get:
<<: *security
tags:
- Dictionary
summary: Получение списка всех городов с возможностью поиска по префиксу имени или по id городов.
parameters:
- name: name
in: query
schema:
type: string
description: Слово для поиска в поле FullName
- name: ids
in: query
schema:
type: array
items: *id
description: >
Список id городов, которые нужно вернуть
Не учитывается, если задан `name`
- name: includedFields
in: query
schema:
type: array
items:
type: string
description: >
Список полей, которые нужно вернуть.
Поле `CityId` возвращается всегда
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/City'
/dictionaries/cities/{id}/:
get:
tags:
- Dictionary
summary: Получение конкретного города по его идентификатору.
parameters:
- name: id
in: path
schema:
type: string
description: Идентификатор города
required: true
- name: count
in: query
schema:
type: string
default: 5
description: Количество БКГ
- name: radius
in: query
schema:
type: string
default: 200
description: Радиус в км
- name: largeCityCount
in: query
schema:
type: string
default: 3
description: размер БКГ
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/City'
404:
description: Город не найден
/dictionaries/cities/{id}:
get:
tags:
- Dictionary
summary: Получение конкретного города по его идентификатору.
parameters:
- name: id
in: path
schema:
type: string
description: Идентификатор города
required: true
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/City'
/dictionaries/carTypes:
get:
tags:
- Dictionary
summary: Выводит список наименований кузовов
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CarType'
/dictionaries/loadingTypes:
get:
tags:
- Dictionary
summary: Выводит список вариантов загрузки
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LoadingType'
/dictionaries/unloadingTypes:
get:
tags:
- Dictionary
summary: Выводит список вариантов разгрузки
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UnloadingType'
/dictionaries/moneyTypes:
get:
tags:
- Dictionary
summary: Выводит список вариантов оплаты
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MoneyType'
/dictionaries/currencyTypes:
get:
tags:
- Dictionary
summary: Выводит список валют
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CurrencyType'
components:
schemas:
# RequestBody
AddLoad:
type: object
required:
- ContactId1
- Loading
- Unloading
- Cargo
- Transport
- Payment
properties:
ContactId1:
$ref: '#/components/schemas/Contact'
ContactId2:
$ref: '#/components/schemas/Contact'
Note:
type: string
FirstDate:
<<: *datetime
description: >
Date with time (00:00:00)
The minimum value is equal to the current date
If the value of the DateType parameter is 0, the valid value of the field is the current date
If the value of the DateType parameter is 1, the valid value of the field is from the current date to 60 days ahead
If the value of the DateType parameter is 2, the valid value of the field is the current date
If the value of the DateType parameter is 3, FirstDate should be the current date value or be absent
LastDate:
<<: *datetime
description: >
Date with time (00:00:00)
The minimum value is equal to the value of the parameter FirstDate
If the value of the DateType parameter is 0, the valid value of the field is from the current date to 1 day ahead
If the value of the DateType parameter is 1, the valid value of the field is from the date in the FirstDate parameter up to 9 days ahead
If the value of the DateType parameter is 2, this field is calculated automatically using the FirstDate formula + 2 months, the transmitted value is ignored
If the value of the DateType parameter is 3, LastDate is automatically set to the value + 2 days from the current date, the transmitted value is ignored
DateType:
type: integer
minimum: 0
maximum: 3
description: >
`Values`:
0 - ready to unloading
1 - from X to Y
2 - constantly
3 - no load, bid request
PeriodicityId:
type: integer
format: int32
enum: [0, 1, 100]
description: >
If the DateType parameter is not equal to 2, PeriodicityId should be equal to 0. Otherwise, PeriodicityId can take the following values:
* 1 - daily
* 100 - on working days
Krugoreis:
type: boolean
Loading:
$ref: '#/components/schemas/LoadingUnloading'
ExtraPoints:
type: array
items:
$ref: '#/components/schemas/ExtraPoint'
Unloading:
$ref: '#/components/schemas/LoadingUnloading'
Cargo:
$ref: '#/components/schemas/Cargo'
Transport:
$ref: '#/components/schemas/Transport'
Payment:
$ref: '#/components/schemas/Payment'
Stealth:
$ref: '#/components/schemas/Stealth'
Boards:
type: array
items:
$ref: '#/components/schemas/LoadBoard'
PriorityView:
$ref: '#/components/schemas/PriorityView'
LoadMeta:
$ref: '#/components/schemas/LoadMeta'
# Models
Account:
type: object
properties:
AccountId: *id
FirmName:
type: string
AdminEmail: *email
Brand:
type: string
Ownership:
type: string
OwnershipId:
<<: *id
Location:
$ref: '#/components/schemas/City'
Address:
type: string
Inn:
type: string
FullFirmName:
type: string
ClaimsSum: *float
ClaimsCount: *count
RecommendationCount: *count
BadPartnerMentionsCount: *count
BadPartnerFirmsCount: *count
TimeZoneMinutes:
<<: *count
minimum: -86400
maximum: 86400
Contacts:
type: array
items:
$ref: '#/components/schemas/Contact'
Passport:
$ref: '#/components/schemas/Passport'
Board:
type: object
properties:
ID: *id
Name:
type: string
Color:
type: string
CreatedOn: *timestamp
ViewOnlyOwn:
type: boolean
UpdatedOn: *timestamp
LogoUrl:
type: string
BoardType:
type: string
enum: [loads, trucks]
BoardExchangeDirection:
type: string
enum: [input , output, exchange]
description: >
input - loads for you. Your customers place cargo on site;
output - your cargo for carriers;
exchange - the exchange of goods between equal participants of the site
OwnerFirm:
type: integer
Contact:
type: object
properties:
Id: *id
Name:
type: string
Telephone:
type: string
Email: *email
Icq:
type: string
Mobile:
type: string
SkypeName:
type: string
Fax:
type: string
Location:
$ref: '#/components/schemas/City'
IsEmailVisibled:
type: boolean
IsVisibled:
type: boolean
Note:
type: string
Passport:
type: object
properties:
TotalScore: *float
ATIDataMatchPoint: *float
AccountLifetimePoint: *float
BusinessActivityPoint: *float
RoundTablePoint: *float
ClaimPoint: *float
ProfActivityPoint: *float
ATIAdministrationPoint: *float
ClonesPoint: *float
EGRPoint: *float
MassRegistrationPoint: *float
MassFounderPoint: *float
FirmLifetimePoint: *float
Status:
type: integer
minimum: 0
maximum: 7
description: >
`Values`:
0 - Gray stars;
1 - Green stars;
2 - Yellow stars;
3 - Red stars;
4 - ATI Partner;
5 - ATI employee;
6 - State organ;
7 - Round table.
StatusDescription:
type: string
Cargo:
description: 'Documentation - http://api.ati.su/help/32018182.html'
type: object
required:
- CargoTypeId
- DogruzType
properties:
Weight: *Weight
Volume: *Volume
ADR: *ADR
CargoTypeId:
<<: *id
CargoType: *CargoType
PackType:
<<: *id
default: 0
PalletCount: *PalletCount
BeltCount: *BeltCount
DogruzType: *DogruzType
SborGruz: *SborGruz
Size:
$ref: '#/components/schemas/Size'
ExtraPoint:
type: object
required:
- CityId
- PointType
properties:
CityId:
<<: *id
PointType:
type: integer
enum: [1, 2, 3]
description: >
Value:
* `1` - Loading
* `2` - UnLoading
* `3` - Custom
Latitude: *Latitude
Longitude: *Longitude
Street:
type: string
LoadingUnloading:
type: object
required:
- CityId
properties:
CityId:
<<: *id
Latitude: *Latitude
Longitude: *Longitude
Street:
type: string
TimeStart: *datetime
TimeEnd: *datetime
LargeCities: *LargeCities
Size:
type: object
properties:
Length: *Length
Width: *Width
Height: *Height
LengthHighlight: *LengthHighlight
WidthHighlight: *WidthHighlight
HeightHighlight: *HeightHighlight
Transport:
type: object
required:
- CarType
properties:
CarType:
<<: *ids
description: >
Bit sum id bodies
LoadingType:
<<: *ids
description: Bit sum id loadings
LoadingLogicalOperator:
<<: *logic
UnloadingType:
<<: *ids
description: >
Bit sum id unloadings
UnloadingLogicalOperator: *logic
TrucksQuantity: *trucksCount
TemperatureFrom: *temperature
TemperatureTo: *temperature
Stsepka: *booleanFalse
Pnevmohod: *booleanFalse
Koniki: *booleanFalse
TIR: *booleanFalse
CMR: *booleanFalse
T1: *booleanFalse
SanPassport: *booleanFalse
Payment:
type: object
properties:
MoneyType:
<<: *id
default: 22
CurrencyId:
<<: *id
RateSum:
<<: *float
SumWithNDS:
<<: *float
SumWithoutNDS:
<<: *float
PrepayPercent:
<<: *percent
default: 0
PayDays:
type: integer
minimum: 0
maximum: 99
default: 0
FixedRate: *booleanTrue
Torg: *booleanFalse
PrepayPercentEnabled: *booleanFalse
DirectContract: *booleanFalse
OnUnloading: *booleanFalse
PayDaysEnabled: *booleanFalse
Stealth:
type: object
properties:
ListIdToHide: *uuid
FirmRegDateToHide: *datetime
ScoreToHide: *float
LoadBoard:
type: object
required:
- BoardId
properties:
BoardId: *idString
PublicationTime:
<<: *datetime
description: It is taken into account if `PublicationOption` is 6.
PublicationOption:
type: integer
enum: [0, 1, 2, 3, 4, 5, 6]
description: >
`Values`:
* 0 - immediately
* 1 - in 15 minutes
* 2 - in 30 minutes
* 3 - in an hour
* 4 - in 3 hours
* 5 - after 6 hours
* 6 - specify the exact time
IsPublished:
type: boolean
readOnly: true
PriorityView:
type: object
properties:
DailyLimit: *IntegerPriorityView
IsForPayedOnly:
type: boolean
OrderLimit: *IntegerPriorityView
ViewRate:
type: integer
format: float
minimum: 0.3
maximum: 99999
MoneySpentPerDay:
type: integer
readOnly: true
MoneySpentPerOrder:
type: integer
readOnly: true
LoadMeta:
type: object
properties:
LoadMetaId: *uuid
MetaData:
type: string
# Dictionaries
OwnerShip:
readOnly: true
type: object
description: Организационно-правовая форма
properties:
Id: *id
Name:
type: string
example: ООО, ЗАО, ИП и др.
City:
readOnly: true
type: object
properties:
CityId: *id
RegionId:
<<: *id
CountryId:
<<: *id
CityName:
type: string
RegionName:
type: string
CountryName:
type: string
CountryCodeName:
type: string
FullName:
type: string
ShortName:
type: string
IsRegionalCenter:
type: boolean
FullNameEng:
type: string
ShortNameEng:
type: string
CitySize:
type: integer
minimum: 0
maximum: 6
description: >
0. system fail
1. to 10.000;
2. from 10.000 to 50.000;
3. from 50.000 to 100.000;
4. from 100.000 to 500.000;
5. from 500.000 to 1.000.000;
6. over 1.000.000.
Longitude: *Longitude
Latitude: *Latitude
Region:
readOnly: true
type: object
properties:
Id: *id
CountryId: *id
Name:
type: string
example: Московская область
NameEng:
type: string
example: Moskovskaya oblast'
RegionClearName:
type: string
example: Московская
RegionTypeAbbr:
type: string
example: обл.
Country:
readOnly: true
type: object
properties:
Id: *id
Name:
type: string
example: Россия
NameEng:
type: string
example: Russia
InterShortName:
type: string
example: RUS
CarType:
type: object
properties:
Id: *id
Name:
type: string
example: контейнер
NameEng:
type: string
example: container
ShortName:
type: string
example: конт.
ShortNameEng:
type: string
example: cont
TypeId:
<<: *id
example: 100
Position:
type: integer
example: 20
CargoType:
readOnly: true
type: object
properties:
Id: *id
Name:
type: string
example: Алкогольные напитки
PackType:
readOnly: true
type: object
properties:
Id: *id
Id2: *uuid
Name:
type: string
example: россыпью
ShortName:
type: string
example: россып
NameEng:
type: string
example: loose
LoadingType:
readOnly: true
type: object
description: Вариант загрузки
properties:
Id: *id
Name:
type: string
example: верхняя
UnloadingType:
readOnly: true
type: object
description: Вариант разгрузки
properties:
Id: *id
Name:
type: string
example: боковая
MoneyType:
readOnly: true
type: object
description: Вариант оплаты
properties:
Id: *id
Name:
type: string
example: нал
NameEng:
type: string
example: cash
CurrencyType:
readOnly: true
type: object
description: Валюта
properties:
Id: *id
Name:
type: string
example: руб
NameEng:
type: string
example: rub
Modifier:
type: integer
example: 1
CurrencyIdPerKm:
type: integer
example: 8
Iso4217Code:
type: string
example: RUB
Iso4217DigitalCode:
type: integer
format: int64
minimum: 0
example: 643
securitySchemes:
OAuth2:
type: oauth2
description: >
[Описание](https://api.ati.su/help/#id-ДокументацияAPI-Какполучитьaccess_token)
flows:
implicit:
authorizationUrl: https://id.ati.su/oauth/
scopes: {}
Command line used for generation
docker run --rm -v %CD%:/local openapitools/openapi-generator-cli generate -i /local/resources/ati.su/swagger.yaml -g php -o /local/app/resources/ati-sdk --invoker-package Ati
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported generation failure with the supplied OpenAPI YAML and openapi-generator 3.3.4, focusing on the anchors, aliases, and merge keys shown in the declaration. Compare generation with and without those YAML constructs; done means the anchored declaration generates successfully without requiring anchors and references to be removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, yaml
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100