Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ the [Java based ApexDoc tool](https://github.com/SalesforceFoundation/ApexDoc) o
later maintained by Salesforce.org, as that tool is no longer being maintained.

ApexDocs is a Node.js library built on Typescript and hosted on [npm](https://www.npmjs.com/package/@cparra/apexdocs).
It offers CLI capabilities to automatically docGenerator a set of files that fully document each one of you classes.
It offers CLI capabilities to automatically document your source code, based on the ApexDoc style of documentation.
Additionally, it can be imported and consumed directly by your JavaScript code.

There are some key differences between ApexDocs and the Java based ApexDoc tool:
Expand Down Expand Up @@ -71,7 +71,10 @@ public class MyClass {
* Apex docs blocks can now all be in a single line
* Support for grouping blocks of related code within a class
* Support for HTML tags
* And more!
* OpenApi REST specification generation
* Support for ignoring files and members from being documented
* Namespace support
* And much, much more!

### Demo

Expand Down Expand Up @@ -329,6 +332,23 @@ To fix this issue, when not sanitizing HTML, you should wrap any code that conta
treated as HTML within '\`'
or within `<code>` tags.


### Ignoring files and members

You can ignore files and members by using the `@ignore` tag on any ApexDoc block. If used at the class level, the entire
file will be ignored. If used at the member level, only that member will be ignored.

Example

```apex
/**
* @ignore
*/
public class MyClass {
public static void myMethod() {}
}
```

## Generating OpenApi REST Definitions

ApexDocs supports generating OpenApi 3.1.0 REST definitions based on any `@RestResource` classes in your source code.
Expand Down
7 changes: 7 additions & 0 deletions docs/Misc-Group/nspc.Reference7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# nspc.Reference7
## Fields

### `untypedObject` → `Object`


---
6 changes: 6 additions & 0 deletions docs/Misc-Group/nspc.SampleRestResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Sample HTTP Delete method with references to other types.

**Http Response** statusCode: 306 schema: List&lt;Reference1&gt;


**Http Response** statusCode: 307 schema: Reference7[untypedObject:Reference2]

### `static doGet()`

`HTTPGET`
Expand Down Expand Up @@ -83,6 +86,9 @@ String
A String SObject.


**Summary** Posts an Account 2


**Http Parameter** name: limit in: query required: true description: Limits the number of items on a page schema: type: integer


Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
### [nspc.Reference6](/Misc-Group/nspc.Reference6.md)


### [nspc.Reference7](/Misc-Group/nspc.Reference7.md)


### [nspc.SampleClassWithoutModifier](/Misc-Group/nspc.SampleClassWithoutModifier.md)


Expand Down
57 changes: 54 additions & 3 deletions docs/restapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
}
],
"paths": {
"/Account/": {
"AccountService/": {
"description": "Account related operations",
"get": {
"tags": [
"Account Service"
],
"description": "This is a sample HTTP Get method",
"parameters": [
{
Expand Down Expand Up @@ -135,7 +138,11 @@
}
},
"post": {
"tags": [
"Account Service"
],
"description": "This is a sample HTTP Post method",
"summary": "Posts an Account 2",
"requestBody": {
"description": "This is an example of a request body",
"content": {
Expand Down Expand Up @@ -252,6 +259,9 @@
}
},
"delete": {
"tags": [
"Account Service"
],
"description": "Sample HTTP Delete method with references to other types.",
"parameters": [
{
Expand Down Expand Up @@ -305,6 +315,16 @@
}
}
},
"307": {
"description": "Status code 307",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Reference7_Reference7[untypedObject:Reference2]"
}
}
}
},
"500": {
"description": "Status code 500",
"content": {
Expand All @@ -318,9 +338,12 @@
}
}
},
"/Contact/": {
"Contact/": {
"description": "Contact related operations",
"get": {
"tags": [
"Contact"
],
"description": "This is a sample HTTP Get method",
"responses": {
"200": {
Expand All @@ -336,9 +359,12 @@
}
}
},
"/Order/": {
"Order/": {
"description": "Order related operations",
"get": {
"tags": [
"Order"
],
"requestBody": {
"content": {
"application/json": {
Expand Down Expand Up @@ -370,6 +396,9 @@
}
},
"patch": {
"tags": [
"Order"
],
"requestBody": {
"content": {
"application/json": {
Expand Down Expand Up @@ -402,6 +431,20 @@
}
}
},
"tags": [
{
"name": "Account Service",
"description": "Account related operations"
},
{
"name": "Contact",
"description": "Contact related operations"
},
{
"name": "Order",
"description": "Order related operations"
}
],
"components": {
"schemas": {
"SampleClass": {
Expand Down Expand Up @@ -525,6 +568,14 @@
"$ref": "#/components/schemas/Reference1"
}
},
"Reference7_Reference7[untypedObject:Reference2]": {
"type": "object",
"properties": {
"untypedObject": {
"$ref": "#/components/schemas/Reference2"
}
}
},
"SampleRestResourceWithInnerClass.InnerClass": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
public interface AnotherInterface{}
public interface AnotherInterface{}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @description Account related operations
*/
@RestResource(urlMapping='/Account/*')
@RestResource(UrlMapping='/AccountService/*')
global with sharing class SampleRestResource {
/**
* @description Sample HTTP Delete method with references to other types.
Expand All @@ -26,6 +26,9 @@ global with sharing class SampleRestResource {
* @http-response
* statusCode: 306
* schema: List<Reference1>
* @http-response
* statusCode: 307
* schema: Reference7[untypedObject:Reference2]
*/
@HttpDelete
global static void doDelete() {
Expand Down Expand Up @@ -114,6 +117,7 @@ global with sharing class SampleRestResource {
}

/**
* @summary Posts an Account 2
* @description This is a sample HTTP Post method
* @return A String SObject.
* @http-parameter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @description This rest resource should be skipped
* @ignore
*/
@RestResource(UrlMapping='/ResourceToSkip/*')
global with sharing class SampleRestResourceToSkip {
@HttpDelete
global static void doDelete() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
delete account;
}

@HttpGet
global static Account doGet() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
return result;
}

@HttpPost
global static String doPost(String name,
String phone, String website) {
Account account = new Account();
account.Name = name;
account.phone = phone;
account.website = website;
insert account;
return account.Id;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class Reference7 {
public Object untypedObject;
}
50 changes: 34 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading