Skip to content

Commit

Permalink
Update Discovery model
Browse files Browse the repository at this point in the history
  • Loading branch information
astrada committed Mar 20, 2012
1 parent 7ef26ff commit 37b640a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/gapi/gapiDiscoveryV1Model.ml
Expand Up @@ -1026,6 +1026,7 @@ struct
basePath : string;
baseUrl : string;
description : string;
discoveryVersion : string;
documentationLink : string;
features : string list;
icons : IconsData.t;
Expand All @@ -1037,6 +1038,7 @@ struct
parameters : (string * JsonSchema.t) list;
protocol : string;
resources : (string * RestResource.t) list;
revision : string;
schemas : (string * JsonSchema.t) list;
title : string;
version : string;
Expand All @@ -1059,6 +1061,10 @@ struct
GapiLens.get = (fun x -> x.description);
GapiLens.set = (fun v x -> { x with description = v });
}
let discoveryVersion = {
GapiLens.get = (fun x -> x.discoveryVersion);
GapiLens.set = (fun v x -> { x with discoveryVersion = v });
}
let documentationLink = {
GapiLens.get = (fun x -> x.documentationLink);
GapiLens.set = (fun v x -> { x with documentationLink = v });
Expand Down Expand Up @@ -1103,6 +1109,10 @@ struct
GapiLens.get = (fun x -> x.resources);
GapiLens.set = (fun v x -> { x with resources = v });
}
let revision = {
GapiLens.get = (fun x -> x.revision);
GapiLens.set = (fun v x -> { x with revision = v });
}
let schemas = {
GapiLens.get = (fun x -> x.schemas);
GapiLens.set = (fun v x -> { x with schemas = v });
Expand All @@ -1121,6 +1131,7 @@ struct
basePath = "";
baseUrl = "";
description = "";
discoveryVersion = "";
documentationLink = "";
features = [];
icons = IconsData.empty;
Expand All @@ -1132,6 +1143,7 @@ struct
parameters = [];
protocol = "";
resources = [];
revision = "";
schemas = [];
title = "";
version = "";
Expand All @@ -1144,6 +1156,7 @@ struct
GapiJson.render_string_value "basePath" x.basePath;
GapiJson.render_string_value "baseUrl" x.baseUrl;
GapiJson.render_string_value "description" x.description;
GapiJson.render_string_value "discoveryVersion" x.discoveryVersion;
GapiJson.render_string_value "documentationLink" x.documentationLink;
GapiJson.render_array "features" (GapiJson.render_string_value "") x.features;
(fun v -> GapiJson.render_object "icons" (IconsData.render_content v)) x.icons;
Expand All @@ -1155,6 +1168,7 @@ struct
GapiJson.render_collection "parameters" GapiJson.Object (fun (id, v) -> (fun v -> GapiJson.render_object id (JsonSchema.render_content v)) v) x.parameters;
GapiJson.render_string_value "protocol" x.protocol;
GapiJson.render_collection "resources" GapiJson.Object (fun (id, v) -> (fun v -> GapiJson.render_object id (RestResource.render_content v)) v) x.resources;
GapiJson.render_string_value "revision" x.revision;
GapiJson.render_collection "schemas" GapiJson.Object (fun (id, v) -> (fun v -> GapiJson.render_object id (JsonSchema.render_content v)) v) x.schemas;
GapiJson.render_string_value "title" x.title;
GapiJson.render_string_value "version" x.version;
Expand Down Expand Up @@ -1184,6 +1198,10 @@ struct
({ GapiJson.name = "description"; data_type = GapiJson.Scalar },
Json_type.String v) ->
{ x with description = v }
| GapiCore.AnnotatedTree.Leaf
({ GapiJson.name = "discoveryVersion"; data_type = GapiJson.Scalar },
Json_type.String v) ->
{ x with discoveryVersion = v }
| GapiCore.AnnotatedTree.Leaf
({ GapiJson.name = "documentationLink"; data_type = GapiJson.Scalar },
Json_type.String v) ->
Expand Down Expand Up @@ -1294,6 +1312,10 @@ struct
("", RestResource.empty)
(fun v -> { x with resources = v })
cs
| GapiCore.AnnotatedTree.Leaf
({ GapiJson.name = "revision"; data_type = GapiJson.Scalar },
Json_type.String v) ->
{ x with revision = v }
| GapiCore.AnnotatedTree.Node
({ GapiJson.name = "schemas"; data_type = GapiJson.Object },
cs) ->
Expand Down Expand Up @@ -1560,11 +1582,16 @@ struct
end

type t = {
discoveryVersion : string;
items : ItemsData.t list;
kind : string;

}

let discoveryVersion = {
GapiLens.get = (fun x -> x.discoveryVersion);
GapiLens.set = (fun v x -> { x with discoveryVersion = v });
}
let items = {
GapiLens.get = (fun x -> x.items);
GapiLens.set = (fun v x -> { x with items = v });
Expand All @@ -1575,13 +1602,15 @@ struct
}

let empty = {
discoveryVersion = "";
items = [];
kind = "";

}

let rec render_content x =
[
GapiJson.render_string_value "discoveryVersion" x.discoveryVersion;
GapiJson.render_array "items" ItemsData.render x.items;
GapiJson.render_string_value "kind" x.kind;

Expand All @@ -1590,6 +1619,10 @@ struct
GapiJson.render_object "" (render_content x)

let rec parse x = function
| GapiCore.AnnotatedTree.Leaf
({ GapiJson.name = "discoveryVersion"; data_type = GapiJson.Scalar },
Json_type.String v) ->
{ x with discoveryVersion = v }
| GapiCore.AnnotatedTree.Node
({ GapiJson.name = "items"; data_type = GapiJson.Array },
cs) ->
Expand Down
9 changes: 9 additions & 0 deletions src/gapi/gapiDiscoveryV1Model.mli
Expand Up @@ -359,6 +359,8 @@ sig
(** The base URL for REST requests. *)
description : string;
(** The description of this API. *)
discoveryVersion : string;
(** Indicate the version of the Discovery API used to generate this doc. *)
documentationLink : string;
(** A link to human readable documentation for the API. *)
features : string list;
Expand All @@ -381,6 +383,8 @@ sig
(** The protocol described by this document. *)
resources : (string * RestResource.t) list;
(** The resources in this API. *)
revision : string;
(** The version of this API. *)
schemas : (string * JsonSchema.t) list;
(** The schemas for this API. *)
title : string;
Expand All @@ -394,6 +398,7 @@ sig
val basePath : (t, string) GapiLens.t
val baseUrl : (t, string) GapiLens.t
val description : (t, string) GapiLens.t
val discoveryVersion : (t, string) GapiLens.t
val documentationLink : (t, string) GapiLens.t
val features : (t, string list) GapiLens.t
val icons : (t, IconsData.t) GapiLens.t
Expand All @@ -405,6 +410,7 @@ sig
val parameters : (t, (string * JsonSchema.t) list) GapiLens.t
val protocol : (t, string) GapiLens.t
val resources : (t, (string * RestResource.t) list) GapiLens.t
val revision : (t, string) GapiLens.t
val schemas : (t, (string * JsonSchema.t) list) GapiLens.t
val title : (t, string) GapiLens.t
val version : (t, string) GapiLens.t
Expand Down Expand Up @@ -496,13 +502,16 @@ sig
end

type t = {
discoveryVersion : string;
(** Indicate the version of the Discovery API used to generate this doc. *)
items : ItemsData.t list;
(** The individual directory entries. One entry per api/version pair. *)
kind : string;
(** The kind for this response. *)

}

val discoveryVersion : (t, string) GapiLens.t
val items : (t, ItemsData.t list) GapiLens.t
val kind : (t, string) GapiLens.t

Expand Down

0 comments on commit 37b640a

Please sign in to comment.