Skip to content

Feat: Support x-scapi-internal (@W-18760261@)#421

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

Feat: Support x-scapi-internal (@W-18760261@)#421
joeluong-sfcc merged 3 commits intofeature/oasfrom
ju/support-x-scapi-internal

Conversation

@joeluong-sfcc
Copy link
Collaborator

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

NOTE: I will fix the CI in a separate PR for ease of review

This PR refactors the api template and pulls out certain parts into mustache partials. This PR also 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}}

To test, you can update apis/products-oas/shopper-products-oas-1.0.36/shopper-products-oas-v1-internal.yaml and add x-scapi-internal to the getProduct/getProducts endpoints, and another custom vendor extension for getCategories:

paths:
  /organizations/{organizationId}/products:
    get:
      x-scapi-internal: true
      operationId: getProducts
  /organizations/{organizationId}/products/{id}:
    get:
      x-scapi-internal: true
      operationId: getProduct
  /organizations/{organizationId}/categories:
    get:
      x-sdk-test: true
      operationId: getCategories

@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner June 24, 2025 15:11
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 adding x-scapi-internal will result in the operation it's tagged with to not be included in the generated sdk.

@joeluong-sfcc joeluong-sfcc merged commit b2a0b34 into feature/oas Jun 26, 2025
5 of 9 checks passed
@joeluong-sfcc joeluong-sfcc deleted the ju/support-x-scapi-internal branch June 26, 2025 15:57
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.

4 participants