@cparra/apexdocs 3.0.0-alpha.9 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +442 -325
  3. package/dist/cli/generate.js +295 -205
  4. package/dist/index.d.ts +15 -17
  5. package/examples/markdown/docs/miscellaneous/Url.md +10 -8
  6. package/examples/markdown/force-app/classes/Url.cls +3 -1
  7. package/examples/markdown-jsconfig/.forceignore +12 -0
  8. package/examples/markdown-jsconfig/apexdocs.config.mjs +21 -0
  9. package/examples/markdown-jsconfig/config/project-scratch-def.json +5 -0
  10. package/examples/markdown-jsconfig/docs/index.md +12 -0
  11. package/examples/markdown-jsconfig/docs/miscellaneous/Url.md +315 -0
  12. package/examples/markdown-jsconfig/force-app/classes/Url.cls +196 -0
  13. package/examples/markdown-jsconfig/package-lock.json +665 -0
  14. package/examples/markdown-jsconfig/package.json +15 -0
  15. package/examples/markdown-jsconfig/sfdx-project.json +12 -0
  16. package/examples/open-api/config/project-scratch-def.json +13 -0
  17. package/examples/open-api/docs/openapi.json +582 -0
  18. package/examples/{force-app → open-api/force-app}/main/default/classes/SampleClass.cls +1 -0
  19. package/examples/open-api/package-lock.json +724 -0
  20. package/examples/open-api/package.json +20 -0
  21. package/examples/open-api/sfdx-project.json +12 -0
  22. package/examples/vitepress/apexdocs.config.ts +7 -2
  23. package/examples/vitepress/docs/index.md +11 -11
  24. package/examples/vitepress/docs/miscellaneous/BaseClass.md +1 -1
  25. package/examples/vitepress/docs/miscellaneous/MultiInheritanceClass.md +2 -2
  26. package/examples/vitepress/docs/miscellaneous/SampleException.md +1 -1
  27. package/examples/vitepress/docs/miscellaneous/SampleInterface.md +6 -6
  28. package/examples/vitepress/docs/miscellaneous/Url.md +3 -3
  29. package/examples/vitepress/docs/sample-enums/SampleEnum.md +3 -3
  30. package/examples/vitepress/docs/samplegroup/SampleClass.md +5 -5
  31. package/examples/vitepress/force-app/main/default/classes/SampleClass.cls +1 -1
  32. package/package.json +2 -2
  33. package/src/application/Apexdocs.ts +39 -7
  34. package/src/application/__tests__/apex-file-reader.spec.ts +0 -17
  35. package/src/application/file-writer.ts +37 -15
  36. package/src/application/generators/markdown.ts +10 -39
  37. package/src/application/generators/openapi.ts +22 -6
  38. package/src/cli/args.ts +4 -1
  39. package/src/cli/commands/markdown.ts +1 -3
  40. package/src/cli/commands/openapi.ts +36 -0
  41. package/src/core/markdown/__test__/generating-class-docs.spec.ts +1 -129
  42. package/src/core/markdown/__test__/generating-docs.spec.ts +111 -0
  43. package/src/core/markdown/__test__/generating-enum-docs.spec.ts +0 -64
  44. package/src/core/markdown/__test__/generating-interface-docs.spec.ts +0 -64
  45. package/src/core/markdown/adapters/documentables.ts +0 -1
  46. package/src/core/markdown/generate-docs.ts +2 -5
  47. package/src/core/markdown/reflection/__test__/filter-scope.spec.ts +306 -0
  48. package/src/core/markdown/reflection/reflect-source.ts +51 -50
  49. package/src/core/openApiSettings.ts +41 -0
  50. package/src/core/openapi/__tests__/open-api-docs-processor.spec.ts +2 -2
  51. package/src/core/openapi/open-api-docs-processor.ts +8 -4
  52. package/src/core/openapi/open-api.ts +5 -1
  53. package/src/core/openapi/openapi-type-file.ts +1 -1
  54. package/src/core/openapi/parser.ts +1 -15
  55. package/src/core/openapi/transpiler.ts +0 -5
  56. package/src/core/parse-apex-metadata.ts +21 -5
  57. package/src/core/shared/types.d.ts +18 -17
  58. package/src/index.ts +23 -10
  59. package/src/test-helpers/SettingsBuilder.ts +2 -6
  60. package/examples/force-app/main/default/classes/AnotherInterface.cls +0 -16
  61. package/examples/force-app/main/default/classes/EscapedAnnotations.cls +0 -5
  62. package/examples/force-app/main/default/classes/GrandparentClass.cls +0 -5
  63. package/examples/force-app/main/default/classes/GroupedClass.cls +0 -8
  64. package/examples/force-app/main/default/classes/InterfaceWithInheritance.cls +0 -1
  65. package/examples/force-app/main/default/classes/MemberGrouping.cls +0 -17
  66. package/examples/force-app/main/default/classes/ParentClass.cls +0 -16
  67. package/examples/force-app/main/default/classes/SampleClass.cls-meta.xml +0 -5
  68. package/examples/force-app/main/default/classes/SampleClassWithoutModifier.cls +0 -9
  69. package/examples/force-app/main/default/classes/SampleInterface.cls +0 -16
  70. package/src/core/settings.ts +0 -56
  71. /package/examples/{force-app → open-api/force-app}/main/default/classes/ChildClass.cls +0 -0
  72. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResource.cls +0 -0
  73. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceToSkip.cls +0 -0
  74. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceWithInnerClass.cls +0 -0
  75. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceWithoutApexDocs.cls +0 -0
  76. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference1.cls +0 -0
  77. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference2.cls +0 -0
  78. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference3.cls +0 -0
  79. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference4.cls +0 -0
  80. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference5.cls +0 -0
  81. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference6.cls +0 -0
  82. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference7.cls +0 -0
package/README.md CHANGED
@@ -1,197 +1,350 @@
1
1
  # ApexDocs
2
2
 
3
- <p align="center">
4
- <b>ApexDocs is a Node.js library with CLI capabilities to docGenerator documentation for Salesforce Apex classes.</b>
5
- </p>
3
+ <div align="center">
4
+ <b>CLI and Node library to generate documentation for Salesforce Apex classes.</b>
6
5
 
6
+ [![CI](https://github.com/cesarParra/apexdocs/actions/workflows/ci.yaml/badge.svg)](https://github.com/cesarParra/apexdocs/actions/workflows/ci.yaml)
7
7
  [![License](https://img.shields.io/github/license/cesarParra/apexdocs)](https://github.com/cesarParra/apexdocs/blob/master/LICENSE)
8
+ [![npm](https://img.shields.io/npm/dm/@cparra/apexdocs)](https://www.npmjs.com/package/@cparra/apexdocs)
9
+ </div>
8
10
 
9
- ## Description
11
+ ApexDocs is a non-opinionated documentation generator for Salesforce Apex classes.
12
+ It can output documentation in Markdown
13
+ format,
14
+ which allows you to use the Static Site Generator of your choice to create a documentation site that fits your needs,
15
+ hosted in any static web hosting service.
10
16
 
11
- ApexDocs was originally built as an alternative to
12
- the [Java based ApexDoc tool](https://github.com/SalesforceFoundation/ApexDoc) originally created by Aslam Bari and
13
- later maintained by Salesforce.org, as that tool is no longer being maintained.
17
+ ## 💿 Installation
14
18
 
15
- ApexDocs is a Node.js library built on Typescript and hosted on [npm](https://www.npmjs.com/package/@cparra/apexdocs).
16
- It offers CLI capabilities to automatically document your source code, based on the ApexDoc style of documentation.
17
- Additionally, it can be imported and consumed directly by your JavaScript code.
18
-
19
- There are some key differences between ApexDocs and the Java based ApexDoc tool:
19
+ ```bash
20
+ npm i -g @cparra/apexdocs
21
+ ```
20
22
 
21
- - **Recursive file search through your module directory structure**. In an `sfdx` based project, all of your classes
22
- will be documented by specifying the top-most directory where file search should begin.
23
- - **Unopinionated documentation site generation**. Instead of creating HTML files, ApexDocs generates a Markdown (.md)
24
- file per Apex class being documented. This means you can host your files in static web hosting services that parse
25
- Markdown like Github Pages or Netlify, and use site generators like Jekyll or Gatsby. This gives you the freedom to
26
- decide how to style your site to match your needs.
23
+ ## Quick Start
27
24
 
28
- #### Features
25
+ ### CLI
29
26
 
30
- * Custom Annotations
27
+ #### Markdown
31
28
 
32
- Any custom annotation defined in the Apexdoc is at the class level are supported, for example the following will be
33
- output to the resulting markdown file:
29
+ Run the following command to generate markdown files for your global Salesforce Apex classes:
34
30
 
35
- ```apex
36
- /**
37
- * @MyCustomAnnotation This is a custom annotation
38
- */
39
- public class MyClass {
40
- }
31
+ ```bash
32
+ apexdocs markdown -s force-app
41
33
  ```
42
34
 
43
- * Single Line ApexDoc Blocks
35
+ #### OpenApi
44
36
 
45
- 📒 Note: If you wish to have multiple `@` tags in a single line but don't want them to be treated as ApexDoc annotations, you can
46
- escape them by adding wrapping the annotation in ticks, for example
37
+ Run the following command to generate an OpenApi REST specification for your Salesforce Apex classes
38
+ annotated with `@RestResource`:
47
39
 
48
- ```apex
49
- /**
50
- * @MyCustomAnnotation This is a custom annotation with an `@embedded` annotation
51
- */
40
+ ```bash
41
+ apexdocs openapi -s force-app
52
42
  ```
53
43
 
44
+ ## 🚀 Features
45
+
46
+ * Generate documentation for Salesforce Apex classes as Markdown files
47
+ * Generate an OpenApi REST specification based on `@RestResource` classes
54
48
  * Support for grouping blocks of related code within a class
55
- * Support for HTML tags
56
- * OpenApi REST specification generation
57
49
  * Support for ignoring files and members from being documented
58
50
  * Namespace support
59
51
  * Configuration file support
52
+ * Single line ApexDoc Blocks
53
+ * Custom tag support
60
54
  * And much, much more!
61
55
 
62
- ### Demo
56
+ ## 👀 Demo
57
+
58
+ ApexDocs generates Markdown files, which can be integrated into any Static Site Generation engine,
59
+ (e.g. Jekyll, Vitepress, Hugo, Docosaurus, etc.) to create a documentation site that fits your needs.
63
60
 
64
- ApexDocs currently supports generating markdown files for Jekyll and Docsify sites, as well as generating plain markdown
65
- files.
61
+ This repo contains several example implementations in the `examples` directory, showcasing how to integrate
62
+ with some of these tools.
63
+
64
+ * [Examples](./examples)
66
65
 
67
66
  ### In the wild
68
67
 
69
- - [Expression](https://cesarparra.github.io/expression/)
68
+ Here are some live projects using ApexDocs:
69
+
70
+ - [Trailhead Apex Recipes](https://github.com/trailheadapps/apex-recipes)
71
+ - [Salesforce Commerce Apex Reference](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/cart-reference.html)
72
+ - [Expression (API)](https://cesarparra.github.io/expression/)
70
73
  - [Nimble AMS Docs](https://nimbleuser.github.io/nams-api-docs/#/api-reference/)
71
- - [Yet Another Salesforce Logger](https://cesarparra.github.io/yet-another-salesforce-logger/#/)
72
74
 
73
- ### [Docsify](https://docsify.js.org/)
75
+ ## ▶️ Available Commands
76
+
77
+ `markdown`
78
+
79
+ ### Flags
80
+
81
+ | Flag | Alias | Description | Default | Required |
82
+ |-------------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------|-----------------|----------|
83
+ | `--sourceDir` | `-s` | The directory where the source files are located. | N/A | Yes |
84
+ | `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
85
+ | `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `global` | No |
86
+ | `--defaultGroupName` | N/A | The default group name to use when a group is not specified. | `Miscellaneous` | No |
87
+ | `--namespace` | N/A | The package namespace, if any. If provided, it will be added to the generated files. | N/A | No |
88
+ | `--sortMembersAlphabetically` | N/A | Sorts the members of a class, interface or enum alphabetically. If false, the members will be displayed in the same order as the code. | `false` | No |
89
+ | `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | `false` | No |
90
+ | `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
74
91
 
75
- Demo
92
+ #### Linking Strategy
76
93
 
77
- - [Docsify](https://cesarparra.github.io/apexdocs/)
94
+ The linking strategy determines how ApexDocs will link to other classes in your documentation. For example,
95
+ if I have class `A` that links through class `B` (e.g. through an `{@link B}` tag, the `@see` tag,
96
+ takes it as a param, returns it from a method, etc.), the linking strategy will determine how the link to class `B` is
97
+ created.
78
98
 
79
- ### [Jekyll](https://jekyllrb.com/)
99
+ These are the possible values for the `linkingStrategy` flag:
80
100
 
81
- Demo
101
+ - `relative`
82
102
 
83
- - [Jekyll](https://cesarparra.github.io/apexdocs-docsify-example/)
103
+ Create a relative link to the class file.
104
+ So if both classes are in the same directory, the link will be created as
105
+ `[B](B.md)`.
106
+ If the classes are in different directories, the link will be created as `[B](../path/to/B.md)`
84
107
 
85
- ## Installation
108
+ - `no-link`
109
+
110
+ Does not create a link at all. The class name will be displayed as plain text.
111
+
112
+ - `none`
113
+
114
+ Does not apply any kind of logic. Instead, the links will be determined by the path to the file
115
+ from the root of the documentation site OR by whatever path you have returned in the `transformReference` hook
116
+ for the file.
117
+
118
+ ### Sample Usage
86
119
 
87
120
  ```bash
88
- npm i -g @cparra/apexdocs
121
+ apexdocs markdown -s force-app -t docs -p global public namespaceaccessible -n MyNamespace
89
122
  ```
90
123
 
91
- ## Usage
124
+ `openapi`
92
125
 
93
- ### CLI
126
+ ### Flags
127
+
128
+ | Flag | Alias | Description | Default | Required |
129
+ |----------------|-------|-------------------------------------------------------------------------------|-----------------|----------|
130
+ | `--sourceDir` | `-s` | The directory where the source files are located. | N/A | Yes |
131
+ | `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
132
+ | `--fileName` | N/A | The name of the OpenApi file. | `openapi.json` | No |
133
+ | `--namespace` | N/A | The package namespace, if any. This will be added to the API file Server Url. | N/A | No |
134
+ | `--title` | N/A | The title of the OpenApi file. | `Apex REST API` | No |
135
+ | `--apiVersion` | N/A | The version of the API. | `1.0.0` | No |
136
+
137
+ ### Sample Usage
94
138
 
95
139
  ```bash
96
- apexdocs-generate
97
- -s src
98
- -t docs
99
- -p global
100
- -g docsify
101
- ```
102
-
103
- The CLI supports the following parameters:
104
-
105
- | Parameter | Alias | Description | Default | Required |
106
- |-----------------------------|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|----------|
107
- | --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
108
- | --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
109
- | --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
110
- | --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private. Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource. | `global` | No |
111
- | --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports: `jekyll`, `docsify`, `plain-markdown`, and `openapi`. | `jekyll` | No |
112
- | --indexOnly | N/A | Defines whether only the index file should be generated. | `false` | No |
113
- | --defaultGroupName | N/A | Defines the `@group` name to be used when a file does not specify it. | `Miscellaneous` | No |
114
- | --sanitizeHtml | N/A | When on, any special character within your ApexDocs is converted into its HTML code representation. This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" because otherwise the content within < and > would be treated as HTML tags and not shown in the output. Content in @example blocks are never sanitized. | true | No |
115
- | --openApiTitle | N/A | If using "openapi" as the target generator, this allows you to specify the OpenApi title value. | `Apex REST Api` | No |
116
- | --title | N/A | Allows you to specify the home page main title. If using "openapi" this acts as an alias to the openApiTitle parameter | `Classes` | No |
117
- | --namespace | N/A | The package namespace, if any. If this value is provided the namespace will be added as a prefix to all of the parsed files. If generating an OpenApi definition, it will be added to the file's Server Url. | N/A | No |
118
- | --openApiFileName | N/A | If using "openapi" as the target generator, this allows you to specify the name of the output file. | `openapi` | No |
119
- | --sortMembersAlphabetically | N/A | Whether to sort the members of a class alphabetically. | `false` | No |
120
- | --includeMetadata | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | false | No |
121
- | --documentationRootDir | N/A | The root directory where the documentation will be generated. This is useful when you want to generate the documentation in a subdirectory of your project. | N/A | No |
122
-
123
- ### Using a configuration file
124
-
125
- You can also use a configuration file to define the parameters that will be used when generating the documentation. Apexdocs
126
- uses [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) to load the configuration file, which means it supports
127
- the following formats:
140
+ apexdocs openapi -s force-app -t docs -n MyNamespace --title "My Custom OpenApi Title"
141
+ ```
142
+
143
+ ## 🔬 Defining a configuration file
144
+
145
+ You can also use a configuration file to define the parameters that will be used when generating the documentation.
146
+
147
+ Configuration files are the main way to integrate the generated documentation with the Static Site Generator of your
148
+ choice and your build process, as well as configuring any custom behavior and the output of the generated files.
149
+
150
+ ### Overview
151
+
152
+ Apexdocs uses [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) to load the configuration file, which means it
153
+ supports the following formats (plus anything else supported by cosmiconfig):
128
154
 
129
155
  - A `package.json` property, e.g. `{ "apexdocs": { "sourceDir": "src", "targetDir": "docs" } }`
130
156
  - A `.apexdocsrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`
131
- - An `apexdocs.config.js` file that exports an object
157
+ - An `apexdocs.config.js` (or `.mjs`) file that exports an object
132
158
  - A `apexdocs.config.ts` file that exports an object
133
159
 
134
- The configuration file should be placed in the root directory of your project.
135
-
136
- **Note that when using a configuration file, you can still override any of the parameters by passing them through the CLI.**
137
-
138
- When defining a `.js` or `.ts` configuration file, your object export can also contain the following functions that will
139
- allow you to override some of the default behavior:
140
-
141
- - `onBeforeFileWrite` - A function that will be called before a file is written to disk. It receives a `TargetFile` object
142
- that contains the file's content, path, and name, etc. It should return a `TargetFile` object with the updated content.
143
- The full object definition can be imported from `@cparra/apexdocs/lib/settings`
144
- - `onAfterProcess` - A function that will be called after all files have been processed. It receives a `TargetFile[]` array
145
- with all of the files that were processed and does not return anything.
146
- - `frontMatterHeader` - A function that will be called before the front matter is written to the file (when using the Jekyll generator).
147
- It receives a `TargetType` object
148
- and should return a list of strings that will be written to the file as the front matter.
149
- The full object definition can be imported from `@cparra/apexdocs/lib/settings`
150
- and contains the following properties:
151
- - `name` - The name of the type
152
- - `typeName` - Can be 'class', 'interface', or 'enum'
153
- - `accessModifier` - The access modifier of the type
154
- - `group` - The group to which the type belongs (if any)
155
- - `description` - The description of the type as defined in the ApexDoc
160
+ **The configuration file should be placed in the root directory of your project.**
161
+
162
+ **Note that when using a configuration file, you can still override any of the parameters by passing them through the
163
+ CLI.**
164
+
165
+ ### Configuration file
166
+
167
+ When defining a configuration file, it is recommended to use ES modules syntax. The config file should `default`
168
+ export an object with the parameters you want to use.:
169
+
170
+ ```javascript
171
+ export default {
172
+ sourceDir: 'force-app',
173
+ targetDir: 'docs',
174
+ scope: ['global', 'public'],
175
+ ...
176
+ }
177
+ ```
178
+
179
+ Every property in the configuration file is optional, and if not provided, either the value provided through the
180
+ CLI will be used, or the default value will be used.
181
+
182
+ ### Config Intellisense
183
+
184
+ Using the `defineMarkdownConfig` helper will provide Typescript-powered intellisense
185
+ for the configuration file options. This should work with both Javascript and Typescript files.
186
+
187
+ ```typescript
188
+ import { defineMarkdownConfig } from "@cparra/apexdocs";
189
+
190
+ export default defineMarkdownConfig({
191
+ sourceDir: 'force-app',
192
+ targetDir: 'docs',
193
+ scope: ['global', 'public'],
194
+ ...
195
+ });
196
+ ```
197
+
198
+ ### Configuration Hooks
199
+
200
+ When defining a `.js` or `.ts` configuration file, your object export can also make use
201
+ of different hooks that will be called at different stages of the documentation generation process.
202
+
203
+ All hooks can be async functions, allowing you to make asynchronous operations, like calling an external API.
204
+
205
+ 📒 Note: The extension hook functions are only available when generating Markdown files (not OpenApi).
206
+
207
+ #### **transformReferenceGuide**
208
+
209
+ Allows changing the Allows changing the frontmatter and content of the reference guide, or even if creating a reference
210
+ guide page should be skipped.
211
+
212
+ **Type**
213
+
214
+ ```typescript
215
+ type TransformReferenceGuide = (referenceGuide: ReferenceGuidePageData) => Partial<ReferenceGuidePageData> | Skip | Promise<Partial<ReferenceGuidePageData> | Skip>;
216
+ ```
217
+
218
+ Example: Updating the frontmatter
156
219
 
157
220
  ```typescript
158
- import {TargetFile} from "@cparra/apexdocs/lib/settings";
159
221
  export default {
160
- onBeforeFileWrite: (file: TargetFile): TargetFile => {
161
- console.log('onBefore writing', file);
162
- return file;
163
- },
164
- onAfterProcess: (files: TargetFile[]) => {
165
- console.log('onAfterProcess files', files);
166
- },
222
+ transformReferenceGuide: (referenceGuide) => {
223
+ return {
224
+ // The frontmatter can either be an object, of the frontmatter string itself
225
+ frontmatter: { example: 'example' }
226
+ };
227
+ }
167
228
  };
229
+ ```
230
+
231
+ Example: skipping the reference guide
168
232
 
233
+ ```typescript
234
+ // The skip function is imported from the package
235
+ import { defineMarkdownConfig, skip } from "@cparra/apexdocs";
236
+
237
+ export default defineMarkdownConfig({
238
+ transformReferenceGuide: (referenceGuide) => {
239
+ return skip();
240
+ }
241
+ });
169
242
  ```
170
243
 
171
- ### Importing to your project
244
+ #### **transformDocs**
245
+
246
+ The main purpose of this hook is to allow you to skip the generation of specific pages,
247
+ by returning a filtered array of `DocPageData` objects.
248
+
249
+ If you want to modify the contents or frontmatter of the docs, use the `transformDocPage` hook instead.
250
+
251
+ **Type**
252
+
253
+ ```typescript
254
+ type TransformDocs = (docs: DocPageData[]) => DocPageData[] | Promise<DocPageData[]>
255
+ ```
256
+
257
+ Example
258
+
259
+ ```typescript
260
+ export default {
261
+ transformDocs: (docs) => {
262
+ return docs.filter(doc => doc.name !== 'MyClass');
263
+ }
264
+ };
265
+ ```
266
+
267
+ #### **transformDocPage**
268
+
269
+ Allows changing the frontmatter and content of the doc page.
270
+
271
+ **Type**
272
+
273
+ ```typescript
274
+ type TransformDocPage = (
275
+ doc: DocPageData,
276
+ ) => Partial<ConfigurableDocPageData> | Promise<Partial<ConfigurableDocPageData>>
277
+ ```
278
+
279
+ Example
280
+
281
+ ```typescript
282
+ export default {
283
+ transformDocPage: (doc) => {
284
+ return {
285
+ frontmatter: { example: 'example' }
286
+ };
287
+ }
288
+ };
289
+ ```
290
+
291
+ #### **transformReference**
292
+
293
+ Allows changing where the files are written to and how files are linked to each other.
294
+
295
+ **Type**
296
+
297
+ ```typescript
298
+ type TransformReference = (
299
+ reference: DocPageReference,
300
+ ) => Partial<ConfigurableDocPageReference> | Promise<ConfigurableDocPageReference>;
301
+ ```
302
+
303
+ Example
304
+
305
+ ```typescript
306
+ export default {
307
+ // Notice how we are setting the linking strategy to none, so that nothing is done
308
+ // to the links by the tool when it tries to link to other classes
309
+ linkingStrategy: 'none',
310
+ transformReference: (reference) => {
311
+ return {
312
+ // Link to the class in Github instead to its doc page.
313
+ referencePath: `https://github.com/MyOrg/MyRepo/blob/main/src/classes/${reference.name}.cls`
314
+ };
315
+ }
316
+ };
317
+ ```
318
+
319
+ ## ⤵︎ Importing to your project
172
320
 
173
321
  If you are just interested in the Apex parsing capabilities, you can use the
174
322
  standalone [Apex Reflection Library](https://www.npmjs.com/package/@cparra/apex-reflection)
175
323
  which is what gets used by this library behind the scenes to generate the documentation files.
176
324
 
177
- ## Documentation Format
325
+ ### 👨‍💻 Typescript
326
+
327
+ If using Typescript, ApexDocs provides all necessary type definitions.
328
+
329
+ ## 📖 Documentation Guide
178
330
 
179
331
  ApexDocs picks up blocks of comments throughout your `.cls` files. The block must begin with `/**` and end with `*/`.
180
332
 
181
- ### Documenting Classes and Interfaces
333
+ ### Top-level files (classes, interfaces, and enums)
182
334
 
183
- The following tags are supported at the class or interface level:
335
+ The following tags are supported at the file level:
184
336
 
185
337
  **Note** Any custom generated tag is also supported. Custom tags can be added with at symbol (`@`) followed by the name
186
338
  of the tag. For example `@custom-tag`
187
339
 
188
- | Tag | Description |
189
- |----------------|------------------------------------------|
190
- | `@description` | One or more lines describing the class. |
191
- | `@see` | The name of a related class. |
192
- | `@group` | The group to which the class belongs to. |
193
- | `@author` | The author of the class. |
194
- | `@date` | The date the class was created. |
340
+ | Tag | Description |
341
+ |----------------|-----------------------------------------|
342
+ | `@description` | One or more lines describing the file. |
343
+ | `@see` | The name of a related file. |
344
+ | `@group` | The group to which the file belongs to. |
345
+ | `@author` | The author of the file. |
346
+ | `@date` | The date the file was created. |
347
+ | `@example` | Example of how the code can be used. |
195
348
 
196
349
  **Example**
197
350
 
@@ -203,30 +356,7 @@ public with sharing class TestClass {
203
356
  }
204
357
  ```
205
358
 
206
- ### Documenting Enums
207
-
208
- The following tags are supported on the enum level:
209
-
210
- | Tag | Description |
211
- |----------------|--------------------------------------------------|
212
- | `@description` | One or more lines describing the enum. |
213
- | `@see` | The name of a related class, enum, or interface. |
214
- | `@group` | The group to which the enum belongs to. |
215
- | `@author` | The author of the enum. |
216
- | `@date` | The date the enum was created. |
217
-
218
- **Example**
219
-
220
- ```apex
221
- /**
222
- * @description This is my enum description.
223
- */
224
- public Enum ExampleEnum {
225
- VALUE_1, VALUE_2
226
- }
227
- ```
228
-
229
- ### Documenting Enum Values
359
+ ### Enum Values
230
360
 
231
361
  The following tags are supported on the enum value level:
232
362
 
@@ -245,9 +375,9 @@ public enum ExampleEnum {
245
375
  }
246
376
  ```
247
377
 
248
- ### Documenting Properties
378
+ ### Properties and Fields
249
379
 
250
- The following tags are supported on the property level:
380
+ The following tags are supported on the property and field level:
251
381
 
252
382
  | Tag | Description |
253
383
  |----------------|--------------------------------------------|
@@ -262,7 +392,7 @@ The following tags are supported on the property level:
262
392
  public String ExampleProperty { get; set; }
263
393
  ```
264
394
 
265
- ### Documenting Methods and Constructors
395
+ ### Methods and Constructors
266
396
 
267
397
  Methods and constructors support the same tags.
268
398
 
@@ -281,18 +411,43 @@ The following tags are supported on the method level:
281
411
  **Example**
282
412
 
283
413
  ```apex
284
- /**
285
- * @description This is my method description.
286
- * @param action The action to execute.
287
- * @return The result of the operation.
288
- * @example
289
- * Object result = SampleClass.call('exampleAction');
290
- */
291
- public static Object call(String action) {
292
- }
414
+ /**
415
+ * @description This is my method description.
416
+ * @param action The action to execute.
417
+ * @return The result of the operation.
418
+ * @example
419
+ * ```
420
+ * Object result = SampleClass.call('exampleAction');
421
+ * ```
422
+ public static Object call(String action) {
423
+ }
293
424
  ```
294
425
 
295
- ### Using custom tags
426
+ ### Code Blocks
427
+
428
+ Code blocks can be added to *almost any tag by using the triple backtick syntax. This is useful when you want to display
429
+ code
430
+ snippets with sample usage or examples.
431
+
432
+ *The non-supported tags are the single line tags, like `@param`, `@return`, `@throws`, `@exception`, `@see`, etc*
433
+
434
+ After the triple backticks, you can optionally specify the language of the code block. This defaults to `apex`,
435
+ but it can be useful to override this when displaying code in other languages, such as `javascript` or `soql`.
436
+
437
+ Example
438
+
439
+ ```apex
440
+ /**
441
+ * @description This is my method description.
442
+ * @sample-usage
443
+ * This is how you can use this method:
444
+ * ```
445
+ * Object result = SampleClass.call('exampleAction');
446
+ * ```
447
+ */
448
+ ```
449
+
450
+ ### Custom Tags
296
451
 
297
452
  You can use custom tags to document your code. Custom tags can be added with at symbol (`@`) followed by the name
298
453
  of the tag. Apexdocs will automatically format tags which words are separated by a dash (`-`) by separating them with a
@@ -311,8 +466,8 @@ display code snippets within your documentation.
311
466
  * System.debug('Hello World');
312
467
  * ```
313
468
  */
314
- public class MyClass {
315
- }
469
+ public class MyClass {
470
+ }
316
471
  ```
317
472
 
318
473
  Note that the language of the code block will be set to `apex` by default, but you can change it by adding the language
@@ -325,43 +480,11 @@ name after the triple backticks. For example, to display a JavaScript code block
325
480
  * console.log('Hello World');
326
481
  * ```
327
482
  */
328
- public class MyClass {
329
- }
330
- ```
331
-
332
- ### Grouping Declarations Within A Class
333
-
334
- A class might have members that should be grouped together. For example, you can have a class for constants with
335
- groups of constants that should be grouped together because they share a common behavior (e.g. different groups
336
- of constants representing the possible values for different picklists.)
337
-
338
- You can group things together within a class by using the following syntax:
339
-
340
- ```apex
341
- // @start-group Group Name or Description
342
- public static final String CONSTANT_FOO = 'Foo';
343
- public static final String CONSTANT_BAR = 'Bar';
344
- // @end-group
483
+ public class MyClass {
484
+ }
345
485
  ```
346
486
 
347
- Groups of members are displayed together under their own subsection after its name or description.
348
-
349
- Some notes about grouping:
350
-
351
- * This is only supported on classes, NOT enums and interfaces
352
- * Supports
353
- * Properties
354
- * Fields (variables and constants)
355
- * Constructors
356
- * Methods
357
- * BUT only members of the same type are grouped together. For example,
358
- if you have a group that contains properties and methods the properties will be grouped together under Properties ->
359
- Group Name, and the methods will be grouped together under Methods -> Group Name
360
- * Does not support inner types (inner classes, interfaces, and enums)
361
- * It is necessary to use `// @end-group` whenever a group has been started, otherwise a parsing error will be raised for
362
- that file.
363
-
364
- ### Inline linking
487
+ ### Inline Linking
365
488
 
366
489
  Apexdocs allows you to reference other classes from anywhere in your docs, and automatically creates a link to that
367
490
  class file for easy navigation.
@@ -379,81 +502,63 @@ Apexdocs recognizes 2 different syntax when linking files:
379
502
  * @param param1 An <<ExampleClass>> instance. Can also do {@link ExampleClass}
380
503
  * @return The result of the operation.
381
504
  */
382
- public static Object doSomething(ExampleClass param1) {}
505
+ public static Object doSomething(ExampleClass param1) {
506
+ }
383
507
  ```
384
508
 
385
- ---
509
+ #### Email linking
386
510
 
387
511
  Email addresses can also be inlined linked by using the `{@email EMAIL_ADDRESS}` syntax.
388
512
 
389
- ### HTML support
513
+ ### Markdown formatting
390
514
 
391
- For the most part all HTML is sanitized when the `--sanitizeHtml` flag is passed a true value (which is the default).
392
- But there are some tags are allowed to have for the possibility of better
393
- styling long text.
515
+ You can use Markdown syntax to format your documentation.
516
+ For example, to create bold text, you can use `**bold text**`, and to create a list you can use the `*` character.
394
517
 
395
- - Allowed tags are: `br`, `p`, `ul`, `li`, and `code`
396
-
397
- Example
518
+ **Example**
398
519
 
399
520
  ```apex
400
521
  /**
401
- * @description <p>This is a paragraph</p>
402
- * <p>And this is another paragraph</p>
403
- * <ul>
404
- * <li>This is a list item</li>
405
- * <li>This is another list item</li>
406
- * </ul>
522
+ * @description This is a description with **bold text**.
523
+ * Which contains a list:
524
+ *
525
+ * **See Also**
526
+ * * [Title](https://example.com)
527
+ * * [Title 2](https://example.com)
407
528
  */
408
- class MyClass {
409
- }
410
529
  ```
411
530
 
412
- ⚠️When the `--sanitizeHtml` flag is ON, any special character between code blocks (i.e. \```, \`, or `<code>`) will also
413
- be escaped.
414
- So if you have references to Apex generic collections (Set, List, or Maps) they will not look right, as the < and >
415
- symbols will be escaped.
416
- To prevent this you can turn the flag off, but be aware of the special considerations when doing this described below.
417
-
418
- ---
419
-
420
- For full control over the output you can also turn off the `--sanitizeHtml` flag, which will allow you
421
- to have any desired HTML within your docs.
422
-
423
- ⚠️When the `--sanitizeHtml` flag is OFF, references to Apex generic collections (Set, List or Maps) can be problematic
424
- as they will be treated as an HTML tag and not displayed. For example if you have something
425
- like `@description Returns a List<String>`
426
- the `<String>` portion will be treated as HTML and thus not appear on the page.
427
-
428
- To fix this issue, when not sanitizing HTML, you should wrap any code that contain special characters that can be
429
- treated as HTML within '\`'
430
- or within `<code>` tags.
431
-
432
- ### Displaying diagrams
433
-
434
- You can display diagrams in your documentation by leveraging Github's built-in [Mermaid](https://mermaid-js.github.io/mermaid/#/) support.
531
+ ### Grouping Declarations Within A Class
435
532
 
436
- If you are using a markdown generator that supports Mermaid (e.g. [Github's markdown](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/),
437
- you can add diagrams to your documentation by using the
438
- `@mermaid` tag.
533
+ A class might have members that should be grouped together. For example, you can have a class for constants with
534
+ groups of constants that should be grouped together because they share a common behavior (e.g. different groups
535
+ of constants representing the possible values for different picklists.)
439
536
 
440
- **Example**
537
+ You can group things together within a class by using the following syntax:
441
538
 
442
539
  ```apex
443
- /**
444
- * @mermaid
445
- * graph TD
446
- * A[Christmas] -->|Get money| B(Go shopping)
447
- * B --> C{Let me think}
448
- * C -->|One| D[Laptop]
449
- * C -->|Two| E[iPhone]
450
- * C -->|Three| F[Car]
451
- */
452
- public class MyClass {
453
- }
540
+ // @start-group Group Name or Description
541
+ public static final String CONSTANT_FOO = 'Foo';
542
+ public static final String CONSTANT_BAR = 'Bar';
543
+ // @end-group
454
544
  ```
455
545
 
456
- [Here's an example of how that looks](/docs/types/Classes/nspc.AnotherInterface.md)
546
+ Groups of members are displayed together under their own subsection after its name or description.
547
+
548
+ Some notes about grouping:
549
+
550
+ * This is only supported on classes, NOT enums and interfaces
551
+ * Supports
552
+ * Properties
553
+ * Fields (variables and constants)
554
+ * Constructors
555
+ * Methods
556
+ * BUT only members of the same type are grouped together. For example,
557
+ if you have a group that contains properties and methods the properties will be grouped together under Properties ->
558
+ Group Name, and the methods will be grouped together under Methods -> Group Name
559
+ * Does not support inner types (inner classes, interfaces, and enums)
560
+ * It is necessary to use `// @end-group` whenever a group has been started, otherwise a parsing error will be raised for
561
+ that file.
457
562
 
458
563
  ### Ignoring files and members
459
564
 
@@ -466,39 +571,44 @@ Example
466
571
  /**
467
572
  * @ignore
468
573
  */
469
- public class MyClass {
470
- public static void myMethod() {}
471
- }
574
+ public class MyClass {
575
+ public static void myMethod() {
576
+ }
577
+ }
472
578
  ```
473
579
 
474
- ## Generating OpenApi REST Definitions
580
+ ## 📄 Generating OpenApi REST Definitions
475
581
 
476
582
  ApexDocs supports generating OpenApi 3.1.0 REST definitions based on any `@RestResource` classes in your source code.
477
583
 
478
584
  ### Usage
479
585
 
480
- To create an OpenApi specification file, run the `apexdocs-generate` and pass `openapi` to the `--targetGenerator` parameter.
481
- When using this generator, you can also pass a custom title through the `--openApiTitle` parameter. This title will be placed
482
- in the output file's `info.title` property, as defined by the [OpenApi documentation for the Info Object](https://spec.openapis.org/oas/v3.1.0#info-object)
483
-
586
+ To create an OpenApi specification file, run `apexdocs openapi`
587
+ When using this generator, you can also pass a custom title through the `--title` parameter.
588
+ This title will be placed in the output file's `info.title` property,
589
+ as defined by the [OpenApi documentation for the Info Object](https://spec.openapis.org/oas/v3.1.0#info-object)
484
590
 
485
591
  ```shell
486
- apexdocs-generate -s ./src -t docs -g openapi --openApiTitle "Custom OpenApi Title"
592
+ apexdocs openapi -s ./src -t docs --title "Custom OpenApi Title"
487
593
  ```
488
594
 
489
595
  ### How It Works
490
596
 
491
- When generating an OpenApi document, since `@RestResource` classes need to be global in Apex, the `--scope` parameter will be ignored.
492
- Instead, ApexDocs will run through all classes annotated with `@RestResource` and add it to the output OpenApi file.
597
+ When generating an OpenApi document,
598
+ ApexDocs will run through all classes annotated with `@RestResource` and add it to the output OpenApi file.
493
599
 
494
- Once it finishes running, a file named `openapi.json` will be created in the specified `--targetDir`.
600
+ Once it finishes running, a file named `openapi.json` (unless a different name is specified) will be created
601
+ in the specified `--targetDir`.
495
602
 
496
603
  ### Configuring What Gets Created
497
604
 
498
605
  ApexDocs will automatically parse your source code and generate the OpenApi definition based on the HTTP related Apex
499
- annotations (RestResource, HttpDelete, HttpGet, HttpPatch, HttpPost, HttpGet). The different HTTP annotations will be used to generate a file that complies with the [OpenApi Specification v3.1.0](https://spec.openapis.org/oas/v3.1.0)
606
+ annotations (`RestResource`, `HttpDelete`, `HttpGet`, `HttpPatch`, `HttpPost`, `HttpGet`). The different HTTP
607
+ annotations will be used to generate a file that complies with
608
+ the [OpenApi Specification v3.1.0](https://spec.openapis.org/oas/v3.1.0)
500
609
 
501
- Besides these annotations, the ApexDocs tool will also use any information provided through your code's Apexdocs, relying on
610
+ Besides these annotations, the ApexDocs tool will also use any information provided through your code's Apexdocs,
611
+ relying on
502
612
  some custom annotations that are specific to generating OpenApi definitions:
503
613
 
504
614
  * `@http-request-body`
@@ -517,6 +627,7 @@ The `schema` can either be a reference to another class in your source code (see
517
627
  or a fully defined custom schema (See the `Custom Schemas` section below).
518
628
 
519
629
  Example
630
+
520
631
  ```apex
521
632
  /**
522
633
  * @description This is a sample HTTP Post method
@@ -524,10 +635,10 @@ Example
524
635
  * description: This is an example of a request body
525
636
  * required: true
526
637
  * schema: ClassName
527
- */
638
+ */
528
639
  @HttpPost
529
640
  global static void doPost() {
530
- ///...
641
+ ///...
531
642
  }
532
643
  ```
533
644
 
@@ -543,6 +654,7 @@ whether it is `required` or not, a `description`, and a `schema`.
543
654
  📝 Note that you can specify as many `@http-parameter` annotations as needed.
544
655
 
545
656
  Example
657
+
546
658
  ```apex
547
659
  /**
548
660
  * @description This is a sample HTTP Post method
@@ -566,11 +678,12 @@ global static String doPost() {
566
678
  ```
567
679
 
568
680
  📝 Note that each parameter of this annotation is expected to be on its own line. Parameters are treated as YAML,
569
- so spacing is important.
681
+ so spacing is important.
570
682
 
571
683
  #### @http-response
572
684
 
573
- Allows you to specify any HTTP response returned by your method. It supports receiving a `statusCode` with the response code,
685
+ Allows you to specify any HTTP response returned by your method. It supports receiving a `statusCode` with the response
686
+ code,
574
687
  a `description`, and a `schema`.
575
688
 
576
689
  If no `description` is provided then one will be automatically built using the `statusCode`.
@@ -599,50 +712,56 @@ global static String doPost() {
599
712
  #### Class References
600
713
 
601
714
  Whenever specifying a `schema` parameter, you can pass as a string the name of any class in your source code. This
602
- class will be parsed by the ApexDocs tool and automatically converted to a reference in the resulting OpenApi definition.
715
+ class will be parsed by the ApexDocs tool and automatically converted to a reference in the resulting OpenApi
716
+ definition.
603
717
 
604
- The tool will parse the class and create a reference that complies with [Apex's support for User-Defined Types](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm#ApexRESTUserDefinedTypes)
718
+ The tool will parse the class and create a reference that complies
719
+ with [Apex's support for User-Defined Types](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm#ApexRESTUserDefinedTypes)
605
720
 
606
721
  ##### Reference Overrides
607
722
 
608
- When dealing with references, there might be cases when you want to manually tell the parser what type of object a property
723
+ When dealing with references, there might be cases when you want to manually tell the parser what type of object a
724
+ property
609
725
  or field is. For example, let's say we have a class that looks as follows
610
726
 
611
727
  ```apex
612
728
  public class MyClass {
613
- public Object myObject;
614
- public Account myAccountRecord;
729
+ public Object myObject;
730
+ public Account myAccountRecord;
615
731
  }
616
732
  ```
617
733
 
618
734
  In this case `myObject` has a type of `Object`, and `myAccountRecord` is an SObject. Neither of these will be accurately
619
- parsed when building the OpenApi definition, instead they will be simple be referenced as `object` without any properties.
735
+ parsed when building the OpenApi definition, instead they will be simple be referenced as `object` without any
736
+ properties.
620
737
 
621
- To accurately represent the shape of these objects, you can use the `@http-schema` annotation to essentially override its
622
- type during parsing. In this annotation you can specify the same thing you would in any `schema` property when dealing with any
738
+ To accurately represent the shape of these objects, you can use the `@http-schema` annotation to essentially override
739
+ its
740
+ type during parsing. In this annotation you can specify the same thing you would in any `schema` property when dealing
741
+ with any
623
742
  of the main `@http-*` methods, meaning a reference to another class, or a Custom Schema (as defined below).
624
743
 
625
744
  ```apex
626
745
  public class MyClass {
627
- /**
628
- * @description This is a generic reference to another class
629
- * @http-schema MyOtherClassName
630
- */
631
- public Object myObject;
632
-
633
- /**
634
- * @description This is a reference to an Account SObject
635
- * @http-schema
636
- * type: object
637
- * properties:
638
- * Id:
639
- * type: string
640
- * Name:
641
- * type: string
642
- * CustomField__c:
643
- * type: number
644
- */
645
- public Account myAccountRecord;
746
+ /**
747
+ * @description This is a generic reference to another class
748
+ * @http-schema MyOtherClassName
749
+ */
750
+ public Object myObject;
751
+
752
+ /**
753
+ * @description This is a reference to an Account SObject
754
+ * @http-schema
755
+ * type: object
756
+ * properties:
757
+ * Id:
758
+ * type: string
759
+ * Name:
760
+ * type: string
761
+ * CustomField__c:
762
+ * type: number
763
+ */
764
+ public Account myAccountRecord;
646
765
  }
647
766
  ```
648
767
 
@@ -652,7 +771,8 @@ If dealing with a collection, you can also specify the name of the reference eit
652
771
 
653
772
  📝 When using List or Set syntax in the `schema` of the ApexDoc `@http-*` annotation, only collections one level
654
773
  deep are supported (e.g. List<List<String>> is not supported). This is only a limitation when referencing collections
655
- on the ApexDoc `schema` property directly, and is fully supported when multi-level collections are inside of a referenced
774
+ on the ApexDoc `schema` property directly, and is fully supported when multi-level collections are inside of a
775
+ referenced
656
776
  class as part of your codebase.
657
777
 
658
778
  Maps are not supported, as it is not possible to know which keys the map will contain, and thus it is not possible
@@ -667,12 +787,13 @@ to convert that to a valid specification. For this use case, define a Custom Sch
667
787
  */
668
788
  @HttpPost
669
789
  global static void doPost() {
670
- ///...
790
+ ///...
671
791
  }
672
792
  ```
673
793
 
674
794
  Inner class references are also supported, but note that you need to pass the full name of the reference,
675
- by using the `ParentClassName.InnerClassName` syntax, even if the inner class resides on the same class as the HTTP method
795
+ by using the `ParentClassName.InnerClassName` syntax, even if the inner class resides on the same class as the HTTP
796
+ method
676
797
  referencing it.
677
798
 
678
799
  ```apex
@@ -684,18 +805,20 @@ referencing it.
684
805
  */
685
806
  @HttpPost
686
807
  global static void doPost() {
687
- ///...
808
+ ///...
688
809
  }
689
810
  ```
690
811
 
691
812
  #### Custom Schemas
692
813
 
693
814
  For any `schema` parameter in any of the HTTP ApexDocs annotations, besides specifying the name of a class, you
694
- can also specify a custom schema definition. The schema definition can either be for a primitive type, an `object` or an `array`
815
+ can also specify a custom schema definition. The schema definition can either be for a primitive type, an `object` or an
816
+ `array`
695
817
 
696
818
  **Primitives**
697
819
 
698
- For primitives, you should specify the `type` and an optional `format`, as defined by the [OpenApi Specification on Data Types](https://spec.openapis.org/oas/v3.1.0#data-types)
820
+ For primitives, you should specify the `type` and an optional `format`, as defined by
821
+ the [OpenApi Specification on Data Types](https://spec.openapis.org/oas/v3.1.0#data-types)
699
822
 
700
823
  ```apex
701
824
  /**
@@ -752,28 +875,22 @@ not reach into your org to get existing SObject describes. Because of this, when
752
875
  you should create a Custom Schema as defined above. This will also allow you to specify which specific
753
876
  fields are being received or returned.
754
877
 
755
-
756
878
  ### Considerations
757
879
 
758
880
  Please be aware of the following when using ApexDocs to create an OpenApi definition:
759
881
 
760
- * Map references are resolved as `object` with no properties, as it is not possible to know which keys the map will contain.
761
- When using maps either create a class that better represents the shape of the object and use a Class Reference, or
762
- define a Custom Schema in the `schema` section of the ApexDoc itself.
763
- * Same thing when referencing SObjects, as SObject describe parsing is not supported by the ApexDocs tool. When referencing
764
- SObjects, consider defining a Custom Schema in the `schema` section of the ApexDoc.
882
+ * Map references are resolved as `object` with no properties, as it is not possible to know which keys the map will
883
+ contain.
884
+ When using maps either create a class that better represents the shape of the object and use a Class Reference, or
885
+ define a Custom Schema in the `schema` section of the ApexDoc itself.
886
+ * Same thing when referencing SObjects, as SObject describe parsing is not supported by the ApexDocs tool. When
887
+ referencing
888
+ SObjects, consider defining a Custom Schema in the `schema` section of the ApexDoc.
765
889
  * ApexDoc is only able to parse through your source code, so references to other packages (namespaced classes) or any
766
- code that lives outside your source code is not supported. Consider creating a Custom Schema for those situations.
767
- * The return value and received parameters or your methods are currently not being considered when creating the OpenApi definition file.
768
- Instead, use the `@http-response` ApexDoc annotation to specify the return value, and `@http-parameter` to specify any
769
- expected parameter.
770
-
771
- ## Typescript
772
-
773
- ApexDocs provides all necessary type definitions.
774
-
775
- ---
890
+ code that lives outside your source code is not supported. Consider creating a Custom Schema for those situations.
891
+ * The return value and received parameters or your methods are currently not being considered when creating the OpenApi
892
+ definition file.
893
+ Instead, use the `@http-response` ApexDoc annotation to specify the return value, and `@http-parameter` to specify any
894
+ expected parameter.
776
895
 
777
- ## 1.X
778
896
 
779
- Looking for documentation for version 1.X? Please refer to its [branch](https://github.com/cesarParra/apexdocs/tree/1.x)