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

Add infoPath to apiItem #968

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omonk
Copy link
Contributor

@omonk omonk commented Sep 16, 2024

Description

To be really honest I'm finding it very hard to follow a lot of the inner workings of this plugin.

I am attempting to replicate the authorization section in my local schema. There is only one security schema in my schema but the plugin choses not to render anything in the ApiItem component but it does in the ApiExplorer

This line is the offending culprit https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/main/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts#L84

I've seen for some reason the API item doesn't have an infoPath so this change adds the info path and renders the auth item appropriately in my project.

Perhaps you could help explain why?

This line picks out info_path of MDX frontmatter and passes it to the ApiExplorer. Unfortunately at that point the MDX for the main ApiItem has been compiled.

Motivation and Context

How Has This Been Tested?

Locally

Screenshots (if appropriate)

image

Types of changes

  • Bug fix?

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@sserrata
Copy link
Member

sserrata commented Sep 16, 2024

Hi @omonk, thanks for reporting this issue. Definitely seems like some cleanup is in order here, at least the component names are not intuitive.

If I'm understanding correctly, you want the "authorization" component to render both inside the ApiItem and ApiExplorer components? I think we used to render it under ApiItem, before our last major redesign.

  • I don't think infoId and infoPath are the same values but I'll double check. It matters because the infoPath is what's used to generate the links to the correct security scheme tab under the generated info doc.
  • It looks like we may have forgotten to clean up the createAuthorization under createApiPageMD but I'll double check.

Either way, it should be possible to achieve what you're asking for, i.e. with a custom markdownGenerators function. I'll look through to see what if anything we can clean up.

@omonk
Copy link
Contributor Author

omonk commented Sep 16, 2024

If I'm understanding correctly, you want the "authorization" component to render both inside the ApiItem and ApiExplorer components?

Yep exactly, it looks as though this was the case previously as the main API template has this template condition as I mentioned.

I don't think there needs to be a custom markdown generator, just passing the infoPath to the API item that i passed around to the markdown generators is enough.

Lots of as any make things quite tricky to parse 😬

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.

2 participants