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

perf(openapi): upload improvements #518

Merged
merged 13 commits into from
Jun 23, 2022

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Jun 17, 2022

🚥 Fix RM-4367

(hopefully) fixes #499

🧰 Changes

  • Behind-the-scenes improvements to openapi command to support new two-part spec upload process 🚀
  • Updated test coverage to reflect these changes1 📈
  • Introduced ora into the mix so users can have better visibility into the validation/upload process 🧭
Previous TODOs (archived)
  • Function for uploading spec to registry 🚀
  • Loading spinners for validation ✅
  • Updates to openapi command to support new process ✨
  • Base config for ora loading spinners 🧭
  • Tests 🧪

🧬 QA & Testing

Do tests pass? You can also test this command with a project of your own by checking out this branch and running:

bin/rdme openapi __tests__/__fixtures__/ref-oas/petstore.json --key=<api key>

Footnotes

  1. I did a lot of test coverage/cleanup work as part of these changes, but that blew up the diff and scope of this PR so any changes unrelated to this new openapi process can be found in #520.

@kanadgupta kanadgupta added enhancement New feature or request performance Issues with performance labels Jun 17, 2022
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Found 11 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Found 11 potential problems in the proposed changes. Check the Files changed tab for more details.

@@ -98,17 +104,21 @@
it('should discover and upload an API definition if none is provided', async () => {
promptHandler.createOasPrompt.mockResolvedValue({ option: 'create' });

const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -139,8 +149,12 @@
['OpenAPI 3.1', 'json', '3.1', 'OpenAPI'],
['OpenAPI 3.1', 'yaml', '3.1', 'OpenAPI'],
])('should support updating a %s definition (format: %s)', async (_, format, specVersion, type) => {
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -159,8 +173,12 @@
});

it('should return warning if providing `id` and `version`', async () => {
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -217,17 +235,21 @@
newVersion: '1.0.1',
});

const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -241,19 +263,22 @@

it('should bundle and upload the expected content', async () => {
let requestBody = null;
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -270,19 +295,22 @@

it('should use specified working directory and upload the expected content', async () => {
let requestBody = null;
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -367,14 +395,18 @@
help: 'If you need help, email [email protected] and mention log "fake-metrics-uuid".',
};

const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -399,14 +457,18 @@
help: 'If you need help, email [email protected] and mention log "fake-metrics-uuid".',
};

const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -419,14 +481,18 @@
});

it('should error if API errors (generic upload error)', async () => {
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@@ -439,14 +505,18 @@
});

it('should error if API errors (request timeout)', async () => {
const registryUUID = getRandomRegistryId();

Check notice

Code scanning

Insecure randomness

Cryptographically insecure [random value](1) in a security context.
@kanadgupta
Copy link
Member Author

kanadgupta commented Jun 23, 2022

codeql blowing up the PR with comments now (that i'm unable to delete)... (shakes fist)

@kanadgupta kanadgupta marked this pull request as ready for review June 23, 2022 02:24
@kanadgupta kanadgupta requested review from erunion, a team, Dashron and domharrington and removed request for a team June 23, 2022 02:26
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

everything here looks pretty solid!

@kanadgupta kanadgupta merged commit e1aeac0 into main Jun 23, 2022
@kanadgupta kanadgupta deleted the kanad/rm-4367-update-rdme-to-support-new-oas-upload branch June 23, 2022 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Issues with performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upload request timed out
2 participants