1
を含んで、私は2つの異なるタイプを定義するために2つのライブラリーを作成しているが、ここで彼らは、次のとおりです。RAML 1.0 ciclicalネストされたが、私はこの問題を持っている
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をよく知っていますので、 "使用"は親として何かを使用する場合にのみ使用するべきですが、私のプロジェクトのどこにいてもすべてを書き直さないようにするにはどうしたらよいでしょうか(なぜなら、 )。
私は1つのファイルで型の基底を定義することを考えましたが、一緒にはならない情報が混在しているだけで、再利用するための「使用」の代替があるかどうかを知りたい別のファイルの型。
ありがとうございます。
私は最後に同じ結論に達しました、私はちょうど必要以上のファイルを作成しないようにしたいと思いましたが、これは正しい方法だと思います。 – 8370