Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Add OpenAPI support #302

Merged
merged 8 commits into from
Jul 16, 2020
Merged

Add OpenAPI support #302

merged 8 commits into from
Jul 16, 2020

Conversation

angoglez
Copy link
Contributor

@angoglez angoglez commented Jun 25, 2020

Description

Related issue (marlow): https://github.com/47deg/marlow/issues/636
Related issue (compendium): #30
This PR adds compendiun OpenAPI support (using YAML or JSON files)

Found issues

  • When storing a schema specifying its idl type it's openapiyaml but you insert as raw a correct OpenAPI JSON, validation step it's done correctly and the schema it's stored. This has something to do with Skeumorph, thought it provides different parsers for each type of file. I think this can lead to inconsistency but I don't have ideas about how to prevent it. It doesn't happen the other way round. (See Unexpected behavior? - OpenAPIParser skeuomorph#303)

@angoglez angoglez marked this pull request as ready for review July 7, 2020 09:44
@fedefernandez
Copy link
Collaborator

@angoglez it seems this has problems with the scalafmt format and compilation errors. Could you please re-format it with scalafmtAll and then fix the compilation errors. I'd be happy to review once it's green 📗

Copy link
Collaborator

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

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

Left a comment, besides that the other changes look good to me.

@@ -1,4 +1,4 @@
CREATE TYPE idl AS ENUM ('avro', 'protobuf', 'mu', 'openapi', 'scala');
CREATE TYPE idl AS ENUM ('avro', 'protobuf', 'mu', 'openapiyaml', 'openapijson', 'scala');
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't change migrations. If we need a change we need to create a new migration file. The idea with the migrations is to manage DB evolutions and changing a previous one makes for an existing installation would make it fail.

I think this post covers what we need here, specially in the Updating/Renaming a Value

Copy link
Collaborator

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

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

The PgStorageSpec should tell you if everything went well. Indeed it detected a missing ;

https://github.com/higherkindness/compendium/pull/302/checks?check_run_id=869965122#step:7:94

val stream: InputStream = getClass.getResourceAsStream("/wrongYamlOpenAPI.yaml")
val text: String = scala.io.Source.fromInputStream(stream).getLines.mkString("\n")
val protocol: Protocol = Protocol(text)
stream.close()
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: use Resource.

It doesn't need to be part of this PR :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea!, but as you said I'd address it in a following PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, thanks @juanpedromoreno! We'll have this in mind.

@angoglez angoglez merged commit 4020d2a into master Jul 16, 2020
@fedefernandez fedefernandez deleted the openapi-636 branch July 16, 2020 10:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants