2017-03-28 19 views
1

RAMLのウェブサイトの状態:変換RAMLデータ型XSD

データ型を使用すると、その後、できる1つのデータタイプを定義せ、スキーマと例の代わりに使用することができますすばやくXMLまたはJSONスキーマに変換することができます。データモデルを定義し、RAMLにRESTを処理させることができます。

どうすればいいですか?継承と文字列パターンを持つ複合型のサポートのレベルは?

答えて

1

この文は、XMLデータ型を使用して複雑な構造を定義できることを示しています。この定義は論理的であり、XMLやJSONのような物理フォーマットは指定しません。

#%RAML 1.0 DataType 
type: AlbumSimple 
displayName: Full Album Object 
properties: 
    artists: ArtistSimple[] # would pull in ArtistSimple DataType 
    copyrights: Copyright[] # would pull in Copyright DataType 
    external_ids: ExternalId # would pull in ExternalId DataType 
    genres: 
    type: string[] 
    description: | 
     A list of the genres used to classify the album. If not yet classified, 
     the array is empty. 
    example: ["Prog Rock", "Post-Grunge"] 
    popularity: 
    type: integer 
    description: | 
     The popularity of the album. The value will be between 0 and 100, 
     with 100 being the most popular. The popularity is calculated from 
     the popularity of the album's individual tracks. 
    tracks: 
    type: Page # would pull in Page DataType 
    (pagedObject): TrackSimple 
    description: The tracks of the album. 

定義は、物理フォーマットを意味するものではありません。

これは、アルバムタイプの定義です。本文のコンテンツタイプを定義する必要があります。

get: 
     is: [ drm ] 
     responses: 
     201: 
      body: 
      application/json: 
       type: AlbumSimple