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

Import and export using CLI #772

Merged
merged 7 commits into from
Nov 20, 2023
Merged

Conversation

Mavbraz
Copy link
Contributor

@Mavbraz Mavbraz commented Jul 27, 2022

Closes #678

Technical implementation details

Checklist

  • Import Swagger v2/OpenAPI v3 (JSON or YAML)
    • Required flags: data and output
    • Optional flags: port and prettify
    • Notes: If more than one environment is returned by parseDataFiles method then a error message will be returned.
  • Export environment to OpenAPI v3 (JSON)
    • Required flags: data and output
    • Optional flags: type ('open-api-v3' is default)
  • data migration added (@mockoon/commons)
  • data migration automated tests added (@mockoon/commons)
  • CLI automated tests added (@mockoon/cli)
  • desktop automated tests added (@mockoon/desktop)

Copy link
Member

@255kb 255kb left a comment

Choose a reason for hiding this comment

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

Apart from the change requests on the code, here are some general remarks:

  • Should we also have a --prettify option in th export like you did for the import?
  • don't forget to update the documentation in the readme for both commands (you can follow the format of the other commands)

Thank you!

packages/cli/src/commands/export.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/export.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/import.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/import.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/import.ts Outdated Show resolved Hide resolved
@255kb
Copy link
Member

255kb commented Sep 9, 2023

Hi @Mavbraz, This PR has no activity since more than one year. Someone else proposed to finish the work (@zerock54). I will hand over this PR next week unless you plan and commit to work on it in the coming weeks.
Let us know.
Thanks!

@Mavbraz
Copy link
Contributor Author

Mavbraz commented Sep 10, 2023

Hello, @255kb! Sorry about the delay.
No worries, I'll finish this PR request ASAP.

@255kb
Copy link
Member

255kb commented Sep 10, 2023

Thanks @Mavbraz , let me know if you need anything.

@Mavbraz
Copy link
Contributor Author

Mavbraz commented Sep 11, 2023

Apart from the change requests on the code, here are some general remarks:

* Should we also have a `--prettify` option in th export like you did for the import?

* don't forget to update the documentation in the readme for both commands (you can follow the format of the other commands)

Thank you!

I think it's more important having this prettify in the export command.
I'm going to include it as well. (It will have the shortcut "p" since it won't be used for the port flag anymore)

FYI: I also updated the commons-server to be able to prettify in other parts of Mockoon if necessary in the future.

@Mavbraz
Copy link
Contributor Author

Mavbraz commented Sep 11, 2023

It's still missing to update the README and add few tests to this PR.
I'll do both in the next few days.

Copy link
Member

@255kb 255kb left a comment

Choose a reason for hiding this comment

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

This looks good.
I requested some changes as in the meantime I removed support for the legacy file format. You can remove these test cases, it should make the CI pass too.
Only the readme doc is remaining, and after that we are good to go!

packages/cli/test/specs/export-command.spec.ts Outdated Show resolved Hide resolved
packages/cli/test/data/openapi/legacy-exported.json Outdated Show resolved Hide resolved
packages/cli/test/specs/export-command.spec.ts Outdated Show resolved Hide resolved
@255kb 255kb marked this pull request as ready for review November 20, 2023 08:48
@255kb 255kb merged commit e2187fb into mockoon:main Nov 20, 2023
9 checks passed
@255kb
Copy link
Member

255kb commented Nov 20, 2023

Thanks for the changes!
It will be included in the November release.

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.

Ability to export to OpenApi V3 Using the CLI
2 participants