Skip to content

Feat: Support x-scapi-internal (@W-18760264@)#202

Merged
joeluong-sfcc merged 18 commits intofeature/oasfrom
ju/support-x-scapi-internal
Jun 23, 2025
Merged

Feat: Support x-scapi-internal (@W-18760264@)#202
joeluong-sfcc merged 18 commits intofeature/oasfrom
ju/support-x-scapi-internal

Conversation

@joeluong-sfcc
Copy link
Contributor

@joeluong-sfcc joeluong-sfcc commented Jun 17, 2025

This PR adds support for the x-scapi-internal custom vendor extension. Whenever an operation is tagged as x-scapi-internal: true, we'll hide that operation from being generated in the SDK

Example:

    get:
      x-scapi-internal: true
      description: ...
      operationId: getProduct

There's unfortunately lots of duplicated code as we have to handle 2 cases

  1. The operation has vendor extensions and x-scapi-internal is present
  2. The operation has no vendor extensions
{{#vendorExtensions}}
{{^x-scapi-internal}}
// Render content for operations that have vendor extensions but NOT x-scapi-internal
{{/x-scapi-internal}}
{{/vendorExtensions}}
{{^vendorExtensions}}
// Render content for operations that have no vendor extensions at all
{{/vendorExtensions}}

@joeluong-sfcc joeluong-sfcc changed the base branch from ju/refactor to feature/oas June 19, 2025 14:37
@joeluong-sfcc joeluong-sfcc changed the base branch from feature/oas to include-nested-api-directories June 19, 2025 20:04
@joeluong-sfcc joeluong-sfcc changed the base branch from include-nested-api-directories to feature/oas June 20, 2025 16:33
@joeluong-sfcc joeluong-sfcc marked this pull request as ready for review June 20, 2025 16:35
@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner June 20, 2025 16:35
@vcua-mobify
Copy link
Contributor

Is the x-scapi-internal our alternative to having -internal and -public OAS specs? Or will we still have both of those after this change?


{{#vendorExtensions}}
{{^x-scapi-internal}}
{{> apis.parameters }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please explain what data gets passed into the included template? Is it the whole object or is is it based on the current context? May be add some comments in the template?

@joeluong-sfcc
Copy link
Contributor Author

Is the x-scapi-internal our alternative to having -internal and -public OAS specs? Or will we still have both of those after this change?

No, we will still have 2 separate OAS specification files, the x-scapi-internal custom property will only be present in the internal OAS file

Copy link
Contributor

@vcua-mobify vcua-mobify left a comment

Choose a reason for hiding this comment

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

I've verified that when x-scapi-internal is added to an endpoint, that endpoint does not get added to the generated SDK.

Endpoints with other custom annotations that don't include x-scapi-internal will still appear.

@joeluong-sfcc joeluong-sfcc merged commit 3f46540 into feature/oas Jun 23, 2025
4 of 6 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.

3 participants