RAML 1.0 循环嵌套包括
RAML 1.0 ciclical nested includes
我有这个问题,我创建了两个库来定义两种不同的类型,它们是:
Category.raml
#%RAML 1.0 Library
uses:
- Event: !include Event.raml
- Tournament: !include Tournament.raml
types:
#############################################################################
base:
usage: The base type for a category
properties:
min_age:
description: The minimum age to participate in the category
required: true
type: number
max_age:
description: The maximum age to participate in the category
required: true
type: number
name:
description: The name of the category
required: true
type: string
gender:
description: The gender of the category
required: true
enum:
- male
- female
- mix
tournament:
description: The tournament of the category
required: true
type: Tournament.base
#############################################################################
full:
usage: A category with all of its events
type: base
properties:
events:
description: The events that the category contains
required: true
type: Event.base[]
Tournament.raml
#%RAML 1.0 Library
uses:
- ClubInscription: !include Club.raml
- Category: !include Category.raml
types:
#############################################################################
base:
usage: The base type for the tournament
properties:
name:
description: The name of the tournament
required: true
type: string
date:
description: Date of the tournament
required: true
type: string
available_lanes:
description: Maximum number of lanes in a serie
required: true
type: number
max_swimmer_inscriptions:
description: Maximum number of events a swimmer may be inscripted
required: true
type: number
award_type:
description: The type of awarding used in the competition
required: true
enum:
- points
- medals
- none
state:
description: The current state of the tournament
required: true
enum:
- closed
- open
- finished
#############################################################################
full:
usage: A tournament with all its categories and club inscriptions
type: base
properties:
club_inscriptions:
description: The clubs inscripted in the tournament
required: true
type: ClubInscription.base[]
categories:
description: The categories the tournament has
required: true
type: Category.base[]
有了这个,发生冲突是有道理的。我对 RAML 非常了解,所以我在某个地方读到“使用”应该只在将某物用作 parent 时使用,但是我应该怎么做才能不 re-write 我项目中任何地方的所有东西(因为这在其中无处不在。
我想过在一个文件中定义类型的基础,但它只是混合了不应该放在一起的信息,我想知道是否有替代“使用”的方法 re-use 另一个文件中的类型。
提前致谢。
最简单的解决方案是 make:
- TournamentBase.raml
- TournamentFull.raml
- CategoryBase.raml
- CategoryFull.raml
你不会有循环依赖。
我有这个问题,我创建了两个库来定义两种不同的类型,它们是:
Category.raml
#%RAML 1.0 Library
uses:
- Event: !include Event.raml
- Tournament: !include Tournament.raml
types:
#############################################################################
base:
usage: The base type for a category
properties:
min_age:
description: The minimum age to participate in the category
required: true
type: number
max_age:
description: The maximum age to participate in the category
required: true
type: number
name:
description: The name of the category
required: true
type: string
gender:
description: The gender of the category
required: true
enum:
- male
- female
- mix
tournament:
description: The tournament of the category
required: true
type: Tournament.base
#############################################################################
full:
usage: A category with all of its events
type: base
properties:
events:
description: The events that the category contains
required: true
type: Event.base[]
Tournament.raml
#%RAML 1.0 Library
uses:
- ClubInscription: !include Club.raml
- Category: !include Category.raml
types:
#############################################################################
base:
usage: The base type for the tournament
properties:
name:
description: The name of the tournament
required: true
type: string
date:
description: Date of the tournament
required: true
type: string
available_lanes:
description: Maximum number of lanes in a serie
required: true
type: number
max_swimmer_inscriptions:
description: Maximum number of events a swimmer may be inscripted
required: true
type: number
award_type:
description: The type of awarding used in the competition
required: true
enum:
- points
- medals
- none
state:
description: The current state of the tournament
required: true
enum:
- closed
- open
- finished
#############################################################################
full:
usage: A tournament with all its categories and club inscriptions
type: base
properties:
club_inscriptions:
description: The clubs inscripted in the tournament
required: true
type: ClubInscription.base[]
categories:
description: The categories the tournament has
required: true
type: Category.base[]
有了这个,发生冲突是有道理的。我对 RAML 非常了解,所以我在某个地方读到“使用”应该只在将某物用作 parent 时使用,但是我应该怎么做才能不 re-write 我项目中任何地方的所有东西(因为这在其中无处不在。
我想过在一个文件中定义类型的基础,但它只是混合了不应该放在一起的信息,我想知道是否有替代“使用”的方法 re-use 另一个文件中的类型。
提前致谢。
最简单的解决方案是 make:
- TournamentBase.raml
- TournamentFull.raml
- CategoryBase.raml
- CategoryFull.raml
你不会有循环依赖。