Skip to content

[Code Update - Chapter 12] Code update for MP GraphQL 2.0#74

Open
ttelang wants to merge 2 commits into
microprofile:mainfrom
ttelang:code-update-mp-graphql-2.0
Open

[Code Update - Chapter 12] Code update for MP GraphQL 2.0#74
ttelang wants to merge 2 commits into
microprofile:mainfrom
ttelang:code-update-mp-graphql-2.0

Conversation

@ttelang
Copy link
Copy Markdown
Contributor

@ttelang ttelang commented Apr 24, 2026

This PR adds comprehensive code examples for Chapter 12 of the MicroProfile Tutorial, demonstrating implementations of MicroProfile GraphQL 2.0 specifications.

What's Included

A complete GraphQL Catalog Service application showcasing:

Core Features:

  • GraphQL API with queries and mutations for product catalog management
  • Field Resolvers using @Source annotation for on-demand relationship resolution
  • Computed Fields for derived data (tax calculations, price categories, stock status)
  • Custom Exception Handling with GraphQL-compliant error responses
  • MicroProfile Config Integration for externalized configuration

Examples:

  1. Product Management

    • Query operations: products, product(id), searchProducts, productCount, averagePrice, categories
    • Mutations: createProduct, updateProduct, deleteProduct
    • Complex queries demonstrating variables, fragments, and aliases
  2. Advanced GraphQL Patterns

    • Field resolvers: reviews, topReviews(limit), averageRating
    • Computed fields: priceWithTax, priceCategory, availabilityStatus
    • Polymorphic queries using the Identifiable interface
    • Error handling with ProductNotFoundException and InsufficientStockException
  3. Supporting Services

    • ProductService - Business logic layer
    • ReviewService - Review operations and aggregations
    • PricingService - Discount and pricing calculations
    • InventoryService - Stock level management
    • OrderService - Order creation and tracking
  4. Data Layer

    • In-memory repositories with sample data initialization
    • Product and Review entities with GraphQL annotations
    • Input types for mutations
  5. Configuration & Documentation

    • Liberty server configuration for Open Liberty runtime
    • Comprehensive README with API documentation
    • Example GraphQL queries (basic queries, mutations, variables, fragments)
    • Schema introspection examples
    • curl command examples for testing

@ttelang ttelang changed the title Code update mp graphql 2.0 [Code Update - Chapter 12] Code update for MP GraphQL 2.0 Apr 24, 2026
@ttelang ttelang marked this pull request as ready for review April 24, 2026 18:50
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.

1 participant