Skip to content

Conversation

@ulrikandersen
Copy link
Contributor

Description

This PR allows specifying default specification via config key defaultSpecificationName.

Motivation and Context

When multiple specifications exist in a repository (project) it is useful to be able to specify which one should be displayed per default.

The default specification is the one displayed when no specification has been selected via the URL or when the project is opened from the sidebar.

It can be either a filename in the repository or the name of a specification in a remote version.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

The default specification is the one displayed when no specification has been selected via the URL or when the project is opened from the sidebar.
Copilot AI review requested due to automatic review settings April 28, 2025 07:06
@ulrikandersen ulrikandersen requested a review from simonbs as a code owner April 28, 2025 07:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a default specification feature that lets users specify which OpenAPI specification is used by default via the config key "defaultSpecificationName". The key changes include using the "isDefault" flag when selecting specifications in various components, extending the OpenApiSpecification schema to include "isDefault", and adding tests to validate the correct default specification behavior.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/features/projects/domain/getProjectSelectionFromPath.ts Uses "isDefault" flag when choosing a specification from a version.
src/features/projects/domain/ProjectNavigator.ts Uses "isDefault" flag to navigate to the default specification.
src/features/projects/domain/OpenApiSpecification.ts Extends the schema with the "isDefault" boolean field.
src/features/projects/domain/IProjectConfig.ts Adds the "defaultSpecificationName" configurable property.
src/features/projects/data/useProjectSelection.ts Updates specification selection using the "isDefault" flag.
src/features/projects/data/GitHubProjectDataSource.ts Maps default specification from config and initializes "isDefault".
test/projects/GitHubProjectDataSource.test.ts Adds tests validating the default specification logic.
Comments suppressed due to low confidence (1)

test/projects/GitHubProjectDataSource.test.ts:955

  • [nitpick] There appears to be inconsistent naming between 'configYml' and 'configYaml' across tests. Consider standardizing the configuration property name to improve clarity.
configYml: { text: `\n            defaultSpecificationName: bar-service.yml\n            remoteVersions:

ulrikandersen and others added 2 commits April 28, 2025 09:41
The default specification is the one displayed when no specification has been selected via the URL or when the project is opened from the sidebar.
@ulrikandersen ulrikandersen force-pushed the feature/configure-default-spec branch from ca487b2 to 6af91b5 Compare April 28, 2025 07:41
simonbs added 2 commits April 28, 2025 10:21
…aultSpecification

# Conflicts:
#	src/features/projects/data/useProjectSelection.ts
#	src/features/projects/domain/ProjectNavigator.ts
#	src/features/projects/domain/getProjectSelectionFromPath.ts
@simonbs
Copy link
Contributor

simonbs commented Apr 28, 2025

This seems like a great idea! I've opened #564 which suggest introducing a getDefaultSpecification(version: Version) function to remove the duplicated code, so we have a single place that defines the logic for the specification to be selected initially.

@ulrikandersen
Copy link
Contributor Author

This seems like a great idea! I've opened #564 which suggest introducing a getDefaultSpecification(version: Version) function to remove the duplicated code, so we have a single place that defines the logic for the specification to be selected initially.

Nice!

Copy link
Contributor

@simonbs simonbs left a comment

Choose a reason for hiding this comment

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

🚀

@ulrikandersen ulrikandersen enabled auto-merge April 28, 2025 08:34
@ulrikandersen ulrikandersen merged commit 581476c into develop Apr 28, 2025
8 checks passed
@ulrikandersen ulrikandersen deleted the feature/configure-default-spec branch April 28, 2025 08:43
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