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

Change the way the prescript finds the header value to change #43

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions sdk-resources/prescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ const updateYamlFiles = (directoryPath) => {
console.error('Error reading file:', err);
return;
}

// Regular expression to find the exact block
const regex = new RegExp(`\\s*- name: X-SailPoint-Experimental\\s*\\n\\s*in: header\\s*\\n\\s*description: Use this header to enable this experimental API\\.\\s*\\n\\s*example: true\\s*\\n\\s*schema:\\s*\\n\\s*type: string\\s*\\n\\s*default: true\\s*\\n\\s*required: true`, 'g');

// Replace 'required: true' with 'required: false'
const updatedData = data.replace(regex, `\n - name: X-SailPoint-Experimental
in: header
description: Use this header to enable this experimental API.
example: true
schema:
type: string
default: true
required: false`);

const updatedData = data.replace(
/(- name: X-SailPoint-Experimental[\s\S]*?required: )true/,
'$1false'
);

// Write the updated YAML back to the file only if changes were made
if (updatedData !== data) {
Expand Down
Loading