Skip to content

Commit

Permalink
Split the API reference markdown into smaller files and use templates…
Browse files Browse the repository at this point in the history
… to generate it.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Mar 4, 2024
1 parent fc1d703 commit 36219ef
Show file tree
Hide file tree
Showing 18 changed files with 749 additions and 450 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ schema:
dune runtest ocaml/idl

doc:
dune build --profile=$(PROFILE) ocaml/idl/datamodel_main.exe
#html
dune build --profile=$(PROFILE) -f @ocaml/doc/jsapigen
mkdir -p $(XAPIDOC)/html
cp -r _build/default/ocaml/doc/api $(XAPIDOC)/html
cp _build/default/ocaml/doc/branding.js $(XAPIDOC)/html
cp ocaml/doc/*.js ocaml/doc/*.html ocaml/doc/*.css $(XAPIDOC)/html
dune exec --profile=$(PROFILE) -- ocaml/idl/datamodel_main.exe -closed -markdown $(XAPIDOC)/markdown
cp ocaml/doc/*.dot ocaml/doc/doc-convert.sh $(XAPIDOC)
#markdown
dune build --profile=$(PROFILE) -f @ocaml/idl/markdowngen
mkdir -p $(XAPIDOC)/markdown
cp -r _build/default/ocaml/idl/autogen/*.md $(XAPIDOC)/markdown
cp -r _build/default/ocaml/idl/autogen/*.yml $(XAPIDOC)/markdown
find ocaml/doc -name "*.md" -not -name "README.md" -exec cp {} $(XAPIDOC)/markdown/ \;
#other
cp ocaml/doc/*.dot ocaml/doc/doc-convert.sh $(XAPIDOC)
# Build manpages, networkd generated these
dune build --profile=$(PROFILE) -f @man

Expand Down
4 changes: 4 additions & 0 deletions ocaml/doc/basics.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
layout: doc
---

# API Basics

This document defines the XenServer Management API - an interface for remotely
Expand Down
4 changes: 4 additions & 0 deletions ocaml/doc/vm-lifecycle.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
layout: doc
---

# VM Lifecycle

The following diagram shows the states that a VM can be in
Expand Down
4 changes: 4 additions & 0 deletions ocaml/doc/wire-protocol.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
layout: doc
---

# Wire Protocol for Remote API Calls

API calls are sent over a network to a Xen-enabled host using an RPC protocol.
Expand Down
12 changes: 12 additions & 0 deletions ocaml/idl/autogen/api-ref-autogen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: doc
---

# API Reference

Version **@xapi-version@**

- [Classes](@root@management-api/classes.html)
- [Relationships Between Classes](@root@management-api/relationships-between-classes.html)
- [Types](@root@management-api/types.html)
- [ErrorHandling](@root@management-api/api-ref-autogen-errors.html)
6 changes: 6 additions & 0 deletions ocaml/idl/autogen/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(alias
(name markdowngen)
(deps
(source_tree .)
)
)
14 changes: 8 additions & 6 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5985,7 +5985,7 @@ module DR_task = struct
)
; (Set String, "whitelist", "The devices to use for disaster recovery")
]
~result:(Ref _dr_task, "The reference to the created task")
~result:(Ref _dr_task, "The reference of the created DR_task")
~doc:
"Create a disaster recovery task which will query the supplied list of \
devices"
Expand Down Expand Up @@ -6202,7 +6202,7 @@ module Blob = struct
}
]
~doc:"Create a placeholder for a binary blob" ~flags:[`Session]
~result:(Ref _blob, "The reference to the created blob")
~result:(Ref _blob, "The reference of the created blob")
~allowed_roles:_R_POOL_OP ()

let destroy =
Expand Down Expand Up @@ -6889,7 +6889,8 @@ module GPU_group = struct
; param_default= Some (VMap [])
}
]
~result:(Ref _gpu_group, "") ~allowed_roles:_R_POOL_OP ()
~result:(Ref _gpu_group, "The reference of the created GPU_group")
~allowed_roles:_R_POOL_OP ()

let destroy =
call ~name:"destroy"
Expand Down Expand Up @@ -7041,7 +7042,7 @@ module VGPU = struct
; param_default= Some (VRef null_ref)
}
]
~result:(Ref _vgpu, "reference to the newly created object")
~result:(Ref _vgpu, "The reference of the created VGPU object")
~allowed_roles:_R_POOL_OP ()

let destroy =
Expand Down Expand Up @@ -7356,7 +7357,7 @@ module PVS_proxy = struct

let create =
call ~name:"create" ~doc:"Configure a VM/VIF to use a PVS proxy"
~result:(Ref _pvs_proxy, "the new PVS proxy")
~result:(Ref _pvs_proxy, "The reference of the created PVS proxy")
~params:
[
(Ref _pvs_site, "site", "PVS site that we proxy for")
Expand Down Expand Up @@ -7626,7 +7627,8 @@ module USB_group = struct
; param_default= Some (VMap [])
}
]
~result:(Ref _usb_group, "") ~allowed_roles:_R_POOL_ADMIN ()
~result:(Ref _usb_group, "The reference of the created USB_group")
~allowed_roles:_R_POOL_ADMIN ()

let destroy =
call ~name:"destroy" ~lifecycle
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ let _ =
~doc:
"The requested update could not be found. Please upload the update \
again. This can occur when you run xe update-pool-clean before xe \
update-apply. "
update-apply."
() ;
error Api_errors.update_pool_apply_failed ["hosts"]
~doc:"The update cannot be applied for the following host(s)." () ;
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ let set_power_on_mode =
; (Changed, rel_stockholm, "Removed iLO script")
]
~in_product_since:rel_midnight_ride
~doc:"Set the power-on-mode, host, user and password "
~doc:"Set the power-on-mode, host, user and password"
~params:
[
(Ref _host, "self", "The host")
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ let _ =
in

if !markdown_mode then
Markdown_backend.all api !dirname ;
Markdown_backend.all api ;

if !dirname <> "" then Unix.chdir !dirname ;
if !dot_mode then
Expand Down
11 changes: 11 additions & 0 deletions ocaml/idl/dune
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,24 @@
(modules datamodel_main dot_backend dtd_backend markdown_backend)
(libraries
dune-build-info
mustache
xapi-datamodel
xapi-stdext-std
xapi-stdext-pervasives
xapi-stdext-unix
)
)

(rule
(alias markdowngen)
(deps
(:x datamodel_main.exe)
(source_tree templates)
)
(package xapi-datamodel)
(action (run %{x} -closed -markdown))
)

(test
(name schematest)
(modes exe)
Expand Down
Loading

0 comments on commit 36219ef

Please sign in to comment.