cesarParra / apexdocs

Node.js tool to generate documentation for your Salesforce Apex Classes.
https://www.npmjs.com/package/@cparra/apexdocs
MIT License
109 stars 18 forks source link

Any documentation around SF Custom Objects #187

Open RaviVaranasi opened 1 week ago

RaviVaranasi commented 1 week ago

Is there a plan to generate Object Overview documentation with Custom Objects? The use case we were looking for is to create documentation on custom objects, permission sets, and where it is used.

cesarParra commented 1 week ago

Yeah, custom objects is definitely on my short-term list. I'm hoping starting investigation into how to parse the meta-xml files in the next few weeks

RaviVaranasi commented 1 week ago

Let me know if you need any help with us or have ideas on how to do this. I'm open to helping

cesarParra commented 6 days ago

@RaviVaranasi that'd be awesome, I'm always open to contributions!

My plan is to tackle was custom objects and fields first and foremost. The project already has a dependency to fast-xml-parser, which today is used to parse the cls-meta.xml files. My plan is to use that to also parse the object/field XML files. This then needs to be parsed further to get a Typescript type representing each object with it's child records that can be used by the different generators.

For the markdown docs I was planning on outputting something that looks as close as possible to Salesforce's object documentation (example: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm).

For the OpenApi output I still need to think through this. Salesforce already offers a way to generate an OpenApi spec for SObjects (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/openapi_beta.htm), so I don't want to duplicate what Salesforce already has.

RaviVaranasi commented 6 days ago

@cesarParra makes sense. Two requirements/important questions to answer from my context:

Does the SF CLI support returning any of this data?

cesarParra commented 6 days ago

@RaviVaranasi I'm not sure I understand the first 2 questions, but in terms of tests there are jest tests for the project in the different __test__ folders.

I want to support Permission Sets at some point, but that's further down the line for me. If that's a higher priority for you feel free to work on that, since I was going to focus on SObjects next anyways (probably in the next couple of weeks, depending on my free time).

This tool does not use the SF CLI for any of the functionality, everything is parsed manually based on the local project. Apex parsing is done through my other library https://github.com/cesarParra/apex-reflection, which this project depends on.

My suggestion is to take a look at the code to get familiar with its structure before any contributions. Everything lives in the src folder. The main entry-point is this function: https://github.com/cesarParra/apexdocs/blob/master/src/application/Apexdocs.ts#L30, so you can follow the codepath to understand how the different parts of the code are structured.