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

style(codeSamples): remove top margin #179

Merged
merged 7 commits into from
Feb 19, 2025
Merged

Conversation

enzonotario
Copy link
Owner

@enzonotario enzonotario commented Feb 18, 2025

Description

Some refactors.

Related issues/external references

Types of changes

  • New feature
  • Breaking change
  • Style

Copy link

vercel bot commented Feb 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vitepress-openapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 10:58pm

Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Warning

Rate limit exceeded

@enzonotario has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ee4929c and 5a09251.

📒 Files selected for processing (7)
  • docs/composables/useTheme.md (3 hunks)
  • package.json (1 hunks)
  • src/components/Request/OARequestBody.vue (2 hunks)
  • src/components/Response/OAResponse.vue (3 hunks)
  • src/components/Schema/OASchemaTabs.vue (3 hunks)
  • src/composables/useTheme.ts (8 hunks)
  • test/composables/useTheme.test.ts (2 hunks)

Walkthrough

The pull request introduces the OAPlayground component in place of the OATryWithVariables component within the feature view, updating the associated import and rendering logic. It also revises import paths for components in the playground directory and standardizes the handling of authorization objects by renaming the property from playgroundValue to value and ensuring that the authorizations variable is always an array. Additional changes include a minor CSS class update and the removal of the deprecated component export. The modifications extend to request-building logic and tests, with corresponding type updates.

Changes

File(s) Summary of Changes
src/components/Feature/OAOperationContent.vue
src/components/index.ts
Replaced the OATryWithVariables component with OAPlayground and removed the old component’s export.
src/components/Playground/OAPlayground.vue Updated import paths for OAPlaygroundParameters and OAPlaygroundResponse from a parent directory to the current directory.
src/components/Playground/OAPlaygroundParameters.vue Changed initialization of authorizations from null to an empty array and renamed playgroundValue to value in the authorization object.
src/components/Sample/OACodeSamples.vue Added the mt-0 CSS class to the <div> element for styling adjustments.
src/lib/codeSamples/buildRequest.ts
src/lib/processOpenAPI/getCodeSamples.ts
Updated function signatures in buildRequest to always treat authorizations as an array, added getAuthorizationsHeaders, and modified authorization headers handling; transformed authorization properties (removing playgroundValue and using name/label).
src/types.ts Modified PlaygroundSecurityScheme type by removing playgroundValue and introducing value as `string
test/lib/buildRequest.test.ts Updated test cases by replacing references to playgroundValue with value in authorization objects.
docs/composables/useTheme.md Added configuration for request and response body views in the useTheme documentation.
src/components/Request/OARequestBody.vue
src/components/Response/OAResponse.vue
Introduced a new defaultView constant using useTheme in both components.
src/components/Schema/OASchemaTabs.vue Added a new defaultView prop and updated logic to utilize it.
src/composables/useTheme.ts Updated ResponseConfig interface and renamed functions related to request body default view.
test/composables/useTheme.test.ts Added tests for getRequestBodyDefaultView and updated assertions to reflect changes in request body configuration.

Sequence Diagram(s)

sequenceDiagram
    participant OperationContent as OAOperationContent
    participant Playground as OAPlayground
    participant Parameters as OAPlaygroundParameters
    participant Response as OAPlaygroundResponse

    OperationContent->>Playground: Render try-it slot with props
    Playground->>Parameters: Render parameters UI
    Playground->>Response: Render response UI
Loading
sequenceDiagram
    participant Caller as Request Builder Caller
    participant buildRequest as buildRequest()
    participant getAuthHeaders as getAuthorizationsHeaders()

    Caller->>buildRequest: Call buildRequest(authorizations, ...)
    buildRequest->>getAuthHeaders: Process authorization schemes
    getAuthHeaders-->>buildRequest: Return updated Headers
    buildRequest-->>Caller: Return complete request object
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

pkg-pr-new bot commented Feb 18, 2025

Open in Stackblitz

npm i https://pkg.pr.new/vitepress-openapi@179

commit: 5a09251

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa89b68 and 6259c93.

📒 Files selected for processing (9)
  • src/components/Feature/OAOperationContent.vue (2 hunks)
  • src/components/Playground/OAPlayground.vue (1 hunks)
  • src/components/Playground/OAPlaygroundParameters.vue (4 hunks)
  • src/components/Sample/OACodeSamples.vue (1 hunks)
  • src/components/index.ts (0 hunks)
  • src/lib/codeSamples/buildRequest.ts (3 hunks)
  • src/lib/processOpenAPI/getCodeSamples.ts (1 hunks)
  • src/types.ts (1 hunks)
  • test/lib/buildRequest.test.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • src/components/index.ts
🧰 Additional context used
🪛 Biome (1.9.4)
src/lib/codeSamples/buildRequest.ts

[error] 51-51: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (9)
src/lib/processOpenAPI/getCodeSamples.ts (1)

33-34: LGTM! Consistent type handling.

The explicit string conversion ensures consistent type handling for name and label properties.

src/types.ts (1)

62-62: LGTM! Type enhancement.

The type change to include string as a possible value type provides more flexibility while maintaining type safety.

src/lib/codeSamples/buildRequest.ts (1)

47-79: LGTM! Well-structured authorization header handling.

The extraction of authorization header logic into a separate function improves code organization and maintainability.

🧰 Tools
🪛 Biome (1.9.4)

[error] 51-51: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)

test/lib/buildRequest.test.ts (2)

34-34: LGTM! Test cases updated correctly.

The test cases have been properly updated to reflect the property rename from 'playgroundValue' to 'value'.

Also applies to: 118-118, 131-131, 145-146


1-1: PR description doesn't match the changes.

The PR is described as "style(codeSamples): remove top margin" but contains significant functional changes to authorization handling. Please update the PR description to accurately reflect the changes being made.

Likely an incorrect or invalid review comment.

src/components/Feature/OAOperationContent.vue (1)

6-6: LGTM! Clean replacement of OATryWithVariables with OAPlayground.

The migration maintains all necessary props and SSR compatibility.

Also applies to: 282-294

src/components/Playground/OAPlaygroundParameters.vue (1)

82-82: LGTM! Improved authorization handling.

The changes enhance type safety and maintain consistency in property naming:

  • Authorization is now always an array
  • More explicit length check for rendering
  • Consistent use of value property

Also applies to: 90-90, 100-102, 131-131, 171-171

src/components/Sample/OACodeSamples.vue (1)

58-58: LGTM! Margin adjustment aligns with PR objective.

Successfully removes top margin from code samples.

src/components/Playground/OAPlayground.vue (1)

5-6: LGTM! Improved import paths.

Import paths now correctly use relative paths for components in the same directory.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6259c93 and ee4929c.

⛔ Files ignored due to path filters (2)
  • e2e/one-page.spec.ts-snapshots/one-page-1-chromium-linux.png is excluded by !**/*.png
  • e2e/one-page.spec.ts-snapshots/one-page-1-firefox-linux.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • docs/composables/useTheme.md (3 hunks)
  • src/components/Request/OARequestBody.vue (2 hunks)
  • src/components/Response/OAResponse.vue (3 hunks)
  • src/components/Schema/OASchemaTabs.vue (3 hunks)
  • src/composables/useTheme.ts (8 hunks)
  • test/composables/useTheme.test.ts (2 hunks)
🔇 Additional comments (10)
src/components/Request/OARequestBody.vue (1)

2-3: LGTM! Clean implementation of theme-based default view.

The changes effectively integrate the theme configuration for request body default view, following Vue.js best practices.

Also applies to: 18-19, 27-27

src/components/Response/OAResponse.vue (1)

31-32: LGTM! Clean implementation of theme-based default view.

The changes effectively integrate the theme configuration for response body default view.

Also applies to: 82-82

src/components/Schema/OASchemaTabs.vue (1)

17-20: LGTM! Well-structured prop definition and improved variable naming.

The changes enhance the component with:

  • Clear prop definition for defaultView
  • More descriptive variable naming (schemaViewerDeep)
  • Proper prop usage in computed values

Also applies to: 23-23, 37-37, 68-68

test/composables/useTheme.test.ts (1)

67-67: LGTM! Comprehensive test coverage for request body default view.

The tests effectively validate:

  • Default value retrieval
  • Value setting and getting
  • Integration with existing schema view functionality

Also applies to: 186-186, 190-190, 194-194

src/composables/useTheme.ts (3)

44-50: LGTM! Well-structured interface extension.

The addition of the body property with defaultView follows the existing pattern and maintains type consistency with the request body configuration.


215-217: LGTM! Consistent configuration initialization.

The response body configuration is properly initialized with the same default value as the request body configuration.


514-521: LGTM! Well-implemented getter and setter functions.

The functions maintain type safety and follow the established pattern consistently.

docs/composables/useTheme.md (3)

45-48: LGTM! Clear and well-documented configuration example.

The example clearly demonstrates how to configure the response body default view with helpful comments.


126-130: LGTM! Well-structured documentation section.

The Request Body Configuration section follows the established documentation pattern and provides accurate information.


152-156: LGTM! Clear and consistent documentation update.

The Response Configuration section is properly updated with the new function while maintaining consistency in format and alignment.

…ltView` by `getRequestBodyDefaultView` and `setRequestBodyDefaultView`
@enzonotario enzonotario merged commit 2467b76 into develop Feb 19, 2025
7 checks passed
@enzonotario enzonotario deleted the feature/playground branch February 20, 2025 23:01
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.

1 participant