Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generate API as TypeDoc docs #1705

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

huwshimi
Copy link
Contributor

Status

READY

Description

Generate docs from the output using TypeDoc.

Fixes: #773.

Related PRs

List related PRs against other branches:

branch PR
other_pr_production link
other_pr_master link

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

> git pull --prune
> git checkout <branch>
> grunt jasmine
  1. Open the orval.config.ts for an example and add docs: true, to the output object.
  2. Run yarn generate-api.
  3. The markdown docs should get built alongside the API files.

@huwshimi huwshimi force-pushed the generate-docs branch 2 times, most recently from 87b24d6 to 6c5ba16 Compare November 15, 2024 06:17
melloware
melloware previously approved these changes Nov 15, 2024
Copy link
Collaborator

@melloware melloware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slick!

@soartec-lab
Copy link
Member

sounds good! I'll try this later.

Copy link
Member

@soartec-lab soartec-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huwshimi

This is amazing. I have made some comments for improvement, so please check them out 👍

Comment on lines 221 to 232
let out = 'docs';
if (app.options.isSet('out')) {
// Use the output location if it has been set in the external config.
out = app.options.getValue('out');
} else if (output.workspace) {
// Generate the docs in the workspace.
out = upath.join(output.workspace, 'docs');
} else if (output.target) {
const base = upath.dirname(output.target);
// Generate the docs along side the output target.
out = upath.join(base, 'docs');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that the default specified location should be docs regardless of workspace or target.

These options are not documents, but output destinations for the application's HTTP client, so their nature is different from the document we will be adding this time.
Also, by not supporting those followers, we get the simplicity of the source code.

Suggested change
let out = 'docs';
if (app.options.isSet('out')) {
// Use the output location if it has been set in the external config.
out = app.options.getValue('out');
} else if (output.workspace) {
// Generate the docs in the workspace.
out = upath.join(output.workspace, 'docs');
} else if (output.target) {
const base = upath.dirname(output.target);
// Generate the docs along side the output target.
out = upath.join(base, 'docs');
}
const out = app.options.getValue('out') || 'docs';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. app.options.getValue('out') defaults to docs inside TypeDoc so we can simplify this slightly further and drop the || 'docs'

melloware
melloware previously approved these changes Nov 18, 2024
@soartec-lab
Copy link
Member

@huwshimi
The test has failed due to the release of v7.3.0. Can I rebase it?
I'll do this as soon as I can see that.

@melloware melloware added this to the 7.3.1 milestone Nov 18, 2024
@huwshimi
Copy link
Contributor Author

@soartec-lab I rebased and fixed the merge conflict. Tests are passing now.

Copy link
Member

@soartec-lab soartec-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all good, Thanks!

@soartec-lab soartec-lab changed the title feat: generate API docs feat: generate API as TypeDoc docs Nov 19, 2024
@soartec-lab soartec-lab merged commit e67fa69 into orval-labs:master Nov 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate Documentation
3 participants