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

Migration of GraphQL todo example app to guide #822

Merged
merged 14 commits into from
Mar 16, 2022
Merged

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Mar 4, 2022

See: micronaut-projects/micronaut-graphql#242
Relates to: micronaut-projects/micronaut-graphql#241

To generate the sample projects and the HTML

./gradlew -x micronautGraphqlTodoRunTestScript micronautGraphqlTodoBuild

You can open the HTML at:

open build/dist/index.html

To run the test for every generated project:

`./gradlew micronautGraphqlTodoBuild`

@sdelamo
Copy link
Contributor Author

sdelamo commented Mar 4, 2022

@timyates To give you a head start, I created the guide skeleton:

  • A new folder under guides with the guide slug micronaut-graphql-todo. That will be part of the guide URL. Thus, it must contain SEO-related terms. We can change this once we understand well what the app is doing.
  • Inside that folder, I created the metadata.json file. It defines whether the guide supports multiple languages, the features used by the generated applications, etc.
  • I moved the deleted code in the example project to the guide.
  • I change the sources package to example.micronaut. Guides generate sample applications with that package. Moreover, some macros (e.g. source:) use that package by default.
  • I created the asciidoc file with the typical sections and added macros to show you how to embed sources or resources.

Next steps:

  • The example application does not have any tests. We have to add tests. We use guides as a functional test suite for Micronaut. Moreover, I think it is important that we show users that they should test their Micronaut applications and how easy and fast is to do that.
  • The example application uses in-memory repositories. We should use JDBC repositories and Flyway or Liquibase for the schema migration. See OpenApI Generator guide or JDBC Guide for an example of how to do that both id code and in the asciidoc sections.
  • Go through every source file and write them as idiomatic as possible.
  • Write the guide. Add callouts and instructions to Javadoc explaining the sources.

Let me know if you have any doubts.

@timyates timyates marked this pull request as ready for review March 10, 2022 20:11
@timyates
Copy link
Contributor

@sdelamo I think this is ready for you to take a look over, before I extend it to kotlin and groovy


* Some time on your hands
* A decent text editor or IDE
* JDK 11 or greater installed with `JAVA_HOME` configured appropriately
Copy link
Member

Choose a reason for hiding this comment

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

Why JDK 11? Either way you should use common-requirements.adoc or common-requirements-jdk11.adoc here

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw the generated build in build/code/micronaut-graphql-todo/micronaut-graphql-todo-gradle-java/build.gradle contained

java {
    sourceCompatibility = JavaVersion.toVersion("11")
    targetCompatibility = JavaVersion.toVersion("11")
}

I will investigate, but I've removed this 11 requirement from the docs for now

----
mn create-app example.micronaut.micronautguide \
--features=@features@ \
--jdk=11 \
Copy link
Member

Choose a reason for hiding this comment

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

these 3 should be on one line

Copy link
Contributor

Choose a reason for hiding this comment

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

Replaced this with create-app-features.adoc


=== Entities

We can then create an Entity class to hold an Author:
Copy link
Member

Choose a reason for hiding this comment

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

hold -> represent

Copy link
Member

Choose a reason for hiding this comment

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

also remove "We can" (most instances throughout)

import java.io.InputStream;
import java.io.InputStreamReader;

@Factory
Copy link
Member

Choose a reason for hiding this comment

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

should have callouts for @Factory and @Bean

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed @Bean as I believe this is covered by @Singleton... But I added an annotation for @Factory and @Singleton

@burtbeckwith
Copy link
Member

I started postgresql in Docker and started the generated app but it fails with error "The server requested password-based authentication, but no password was provided."

@sdelamo
Copy link
Contributor Author

sdelamo commented Mar 14, 2022

@sdelamo I think this is ready for you to take a look over, before I extend it to kotlin and groovy

@timyates Please, address @burtbeckwith feedback.

@timyates
Copy link
Contributor

I started postgresql in Docker and started the generated app but it fails with error "The server requested password-based authentication, but no password was provided."

Did you set the environment variables 🤔

https://github.com/micronaut-projects/micronaut-guides/pull/822/files#diff-63446198a1e091f309f808504b1dfefc9b34f0cecb74b46e8114ff4510eae9a0R210-R214

Do we need to make this stand out more in the guide?

@timyates
Copy link
Contributor

I have removed all instances of We (made it more instructional than collaborative), and I believe addressed all the above feedback

Thanks @burtbeckwith 👍

@sdelamo
Copy link
Contributor Author

sdelamo commented Mar 16, 2022

@timyates great job.

Always use callouts:

Try to use as many common callouts as possible. Those ensure guides are consistent and easier to write update.

Try to use common snippets as well.

a7523e0

ae42a04

@sdelamo sdelamo merged commit 4f2cad3 into master Mar 16, 2022
@sdelamo sdelamo deleted the graphql-micronaut-todo branch March 16, 2022 19:42
timyates added a commit that referenced this pull request Mar 17, 2022
* Migration of GraphQL todo example app to guide

See: micronaut-projects/micronaut-graphql#242
Relates to: micronaut-projects/micronaut-graphql#241

* remove tags and add languages to metadata.json

* Add todo graphql guide and add tests

* Switch to postgres and Flyway

* Update screenshot to new ID format

* More asciidoc work

* Polish

* Further cleanups...

* Address feedback

* use common flyway

* use common test

* use callouts

Co-authored-by: Tim Yates <tim.yates@gmail.com>
AndreaLaGrotteria pushed a commit to AndreaLaGrotteria/micronaut-guides that referenced this pull request Oct 3, 2024
* Migration of GraphQL todo example app to guide

See: micronaut-projects/micronaut-graphql#242
Relates to: micronaut-projects/micronaut-graphql#241

* remove tags and add languages to metadata.json

* Add todo graphql guide and add tests

* Switch to postgres and Flyway

* Update screenshot to new ID format

* More asciidoc work

* Polish

* Further cleanups...

* Address feedback

* use common flyway

* use common test

* use callouts

Co-authored-by: Tim Yates <tim.yates@gmail.com>
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.

3 participants