Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 10, 2025

πŸŽ‰ Complete Implementation

This pull request successfully implements a GraphQL-style API that uses LINO instead of JSON, as requested in issue #34.

πŸ“‹ Issue Reference

Fixes #34

✨ Features Implemented

🌐 LINO GraphQL API Server

  • HTTP Server: Full ASP.NET Core-based server with GraphQL endpoint
  • LINO Notation: Uses LINO syntax instead of JSON for queries and responses
  • GraphQL Compatibility: Supports GraphQL-style query structure translated to LINO
  • Web Playground: Built-in web interface for testing queries at http://localhost:5000/

πŸ”§ New CLI Commands

# Start GraphQL API server
clink serve --port 5000 --trace

# Traditional query execution (backward compatible)  
clink query '() ((1 1))' --changes --after

πŸ“‘ API Endpoints

  • POST /graphql - Main GraphQL endpoint accepting LINO queries
  • GET /graphql?query=... - GraphQL GET queries
  • GET / - Interactive web playground
  • GET /schema - Schema introspection in LINO format

πŸ” Query Examples

# Query all links with specific fields
curl -X POST http://localhost:5000/graphql \
  -H "Content-Type: text/plain" \
  -d "(query (links (id source target)))"

# Query specific link  
curl -X POST http://localhost:5000/graphql \
  -d "(query (link (id: 1) (id source target)))"

# Schema introspection
curl -X POST http://localhost:5000/graphql \
  -d "(query (__schema))"

πŸ“Š Response Format

Responses use LINO notation:

(response (data (links ((id: 1) (source: 1) (target: 1)) ((id: 2) (source: 2) (target: 2)))))

πŸ—οΈ Technical Implementation

Core Components

  • LinoGraphQLProcessor: Query parsing and execution engine
  • LinoGraphQLServer: HTTP server with routing and middleware
  • Updated Program.cs: New command structure with serve subcommand
  • Comprehensive Tests: Unit tests covering all GraphQL functionality

Architecture Highlights

  • Backward Compatibility: Existing CLI functionality unchanged
  • Schema Support: Built-in schema introspection and type definitions
  • Error Handling: Proper error responses in LINO format
  • Tracing: Optional verbose logging for debugging
  • Content Negotiation: Supports both LINO and JSON responses based on Accept header

πŸ§ͺ Testing

  • Unit tests for GraphQL processor functionality
  • Integration tests for server endpoints
  • Playground interface for manual testing
  • All existing CLI tests continue to pass

πŸ“¦ Version Update

  • Updated version to 2.3.0 for this major feature addition

πŸš€ Usage

  1. Start the server:

    clink serve --port 5000
  2. Open web playground: Navigate to http://localhost:5000/

  3. Test queries: Try example queries like (query (links (id source target)))

  4. Use programmatically: Send HTTP requests to /graphql endpoint

This implementation successfully bridges GraphQL concepts with LINO notation, providing a unique API that leverages the power of link-based data structures while maintaining GraphQL's flexible query capabilities.


πŸ€– Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #34
@konard konard self-assigned this Sep 10, 2025
konard and others added 2 commits September 10, 2025 14:57
…SON)

Add comprehensive GraphQL-style API that uses LINO notation instead of JSON for both requests and responses:

β€’ Add LinoGraphQLProcessor: Core query processing engine that translates GraphQL-style queries in LINO notation to link operations
β€’ Add LinoGraphQLServer: HTTP server with ASP.NET Core that serves the GraphQL API with web playground interface
β€’ Add 'serve' command: New CLI command to start the GraphQL API server (clink serve --port 5000)
β€’ Add comprehensive test suite: Unit tests for GraphQL processor functionality
β€’ Update CLI structure: Maintain backward compatibility while adding new server capabilities
β€’ Update version to 2.3.0: Prepare for release with new GraphQL API feature

The API supports:
- GraphQL-style queries using LINO notation: (query (links (id source target)))
- Schema introspection: (query (__schema)) and (query (schema))
- Single link queries: (query (link (id: 1) (id source target)))
- HTTP endpoints: POST/GET /graphql, GET / (playground), GET /schema
- Both LINO and JSON response formats based on Accept header

Example usage:
  clink serve --port 5000 --trace
  curl -X POST http://localhost:5000/graphql -d "(query (links (id source target)))"

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] LINO API (GraphQL) LINO API (GraphQL) - Complete Implementation Sep 10, 2025
@konard konard marked this pull request as ready for review September 10, 2025 12:18
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.

LINO API (GraphQL)

2 participants