Skip to content

Conversation

@tobySolutions
Copy link
Contributor

Why?

This pull request is here to handle the work being done to auto-populate the website with the API docs from the open API docs we currently manage.

How?

  • Installed and setup BadMagic
  • Implemented data fetching and parsing
  • Rendered data
  • [] Ensure all endpoints work correctly
  • [] Fix styling / branding

Tickets?

Contribution checklist?

  • The commit messages are detailed
  • The build command runs locally
  • Assets or static content are linked and stored in the project
  • Document filename is named after the slug
  • You've reviewed spelling using a grammar checker
  • For documentation, guides or references, you've tested the commands and steps
  • You've done enough research before writing

Security checklist?

  • Sensitive data has been identified and is being protected properly
  • Injection has been prevented (parameterized queries, no eval or system calls)
  • The Components are escaping output (to prevent XSS)

@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2025

⚠️ No Changeset found

Latest commit: 177fae8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tobySolutions tobySolutions marked this pull request as draft February 21, 2025 12:48
return <BadMagic basename="/api" workspaces={workspaces} />;
}

export default BadMagicClient;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export default BadMagicClient;

tags?: { name: string; description?: string }[];
};

export function BadMagicClient() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export function BadMagicClient() {
export const BadMagicClient = () => {


const fetchAndTransformSpec = async () => {
try {
const response = await fetch('https://api.fleek.xyz/api/openapi.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be based on environment.

Suggested change
const response = await fetch('https://api.fleek.xyz/api/openapi.json');
const response = await fetch(openApiUrl);

Find the environment variable correct name or name it correctly.

const openApiUrl = import.meta.env.PUBLIC_OPEN_API_URL;

Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to keep it simple and use /src/layouts/BaseHtml.astro.

const routesByTag = new Map<string, BadMagicRoute[]>();

// Process each path and its methods
Object.entries(data.paths).forEach(([path, pathItem]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not very clear what you're trying to achieve here.

The API response is not a valid expected schema for this package badmagicclient, is this correct?

Would the following parser work for you? https://github.com/scalar/scalar/blob/main/packages/openapi-parser/README.md

The current API dashboard we have is open source but I believe that'd be a bit tricky for you to handle, e.g. https://github.com/scalar/scalar

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.

3 participants