public inbox for pve-user@lists.proxmox.com
 help / color / mirror / Atom feed
* [PVE-User] Extracting/leveraging the JSON schema
@ 2020-12-16  9:48 Erik Hollensbe
  2020-12-16 10:30 ` Fabian Grünbichler
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Hollensbe @ 2020-12-16  9:48 UTC (permalink / raw)
  To: pve-user

I'd like to extract the JSON schema for use in generating a golang API.
Judging from brief googling I've seen others have attempted this but I was
hoping to make an effective dent in the problem. I think it'd be really
useful in terraform and other orchestration tools that are typically
written in that language (these days at least).

I reviewed the pve-common packages, specifically, the PVE::JSONSchema perl
module and it looks like a parser but not the actual API.

Best I can tell from googling and looking at the files in /usr/share/pve is
that there is a api.js (I forget the exact filename) that contains what I
seek, unfortunately it is coupled with some additional framework code to
generate it all, best I can tell?

What I'd really like to do is get ya'll up to speed so that your API can be
consumed by codegen tools that are out there. Let me know how I can help
and facilitate this. Swagger would be a bold idea/ideal here, if you're up
for considering something along those lines as well. The swagger/openapi
codegen tools are dull but effective for a lot of languages.

The PVE API is vast and I don't see the feasibility in porting it by hand
100%, especially when you consider future maintenance burdens, so something
that could generate code or dynamically configure a client would be an
ideal solution assuming it is needed and can be bootstrapped.

Thanks and I hope this message from a brand new ML user is not too forward
:)

-Erik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PVE-User] Extracting/leveraging the JSON schema
  2020-12-16  9:48 [PVE-User] Extracting/leveraging the JSON schema Erik Hollensbe
@ 2020-12-16 10:30 ` Fabian Grünbichler
  2020-12-16 11:24   ` Erik Hollensbe
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Grünbichler @ 2020-12-16 10:30 UTC (permalink / raw)
  To: Proxmox VE user list, Erik Hollensbe

> Erik Hollensbe <erik@hollensbe.org> hat am 16.12.2020 10:48 geschrieben:
> I'd like to extract the JSON schema for use in generating a golang API.
> Judging from brief googling I've seen others have attempted this but I was
> hoping to make an effective dent in the problem. I think it'd be really
> useful in terraform and other orchestration tools that are typically
> written in that language (these days at least).
> 
> I reviewed the pve-common packages, specifically, the PVE::JSONSchema perl
> module and it looks like a parser but not the actual API.

yes, pve-common contains the basic framework, the API itself is distributed over the other packages (mainly pve-storage, pve-container, qemu-server, and the main API daemons and entrypoint in pve-manager).

> Best I can tell from googling and looking at the files in /usr/share/pve is
> that there is a api.js (I forget the exact filename) that contains what I
> seek, unfortunately it is coupled with some additional framework code to
> generate it all, best I can tell?

apidata.js is generated by the following (veeeeery short ;)) perl script:

https://git.proxmox.com/?p=pve-docs.git;a=blob;f=extractapi.pl;h=06d6af4cb2cabe8bbdf514ed03046879bf53c15b;hb=HEAD

it pulls in the main API endpoint (PVE::API2) and the API handler (PVE::RESTHandler). the latter already has all the dumping functionality built-in. it should run on any host that has PVE installed.

> What I'd really like to do is get ya'll up to speed so that your API can be
> consumed by codegen tools that are out there. Let me know how I can help
> and facilitate this. Swagger would be a bold idea/ideal here, if you're up
> for considering something along those lines as well. The swagger/openapi
> codegen tools are dull but effective for a lot of languages.

there have been some efforts like that in the past (mostly from the nodejs camp AFAICT). maybe take a look at https://pve.proxmox.com/wiki/Proxmox_VE_API#Clients and see what other people have done so far ;)
 
> The PVE API is vast and I don't see the feasibility in porting it by hand
> 100%, especially when you consider future maintenance burdens, so something
> that could generate code or dynamically configure a client would be an
> ideal solution assuming it is needed and can be bootstrapped.
> 
> Thanks and I hope this message from a brand new ML user is not too forward
> :)

good luck with your project! don't hesitate to ask if you have further questions (although if they get more technical, I'd suggest switching to pve-devel instead of pve-user :))




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PVE-User] Extracting/leveraging the JSON schema
  2020-12-16 10:30 ` Fabian Grünbichler
@ 2020-12-16 11:24   ` Erik Hollensbe
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Hollensbe @ 2020-12-16 11:24 UTC (permalink / raw)
  To: Fabian Grünbichler; +Cc: Proxmox VE user list

On Wed, Dec 16, 2020 at 2:30 AM Fabian Grünbichler <
f.gruenbichler@proxmox.com> wrote:

>
> good luck with your project! don't hesitate to ask if you have further
> questions (although if they get more technical, I'd suggest switching to
> pve-devel instead of pve-user :))
>

Thanks for your help! I will sign up for the -devel list too.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-16 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16  9:48 [PVE-User] Extracting/leveraging the JSON schema Erik Hollensbe
2020-12-16 10:30 ` Fabian Grünbichler
2020-12-16 11:24   ` Erik Hollensbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal