Authentication-Results: mail-b.sr.ht; dkim=pass header.d=protonmail.com header.i=@protonmail.com Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by mail-b.sr.ht (Postfix) with ESMTPS id E5EF611EF1E for <~emersion/hut-dev@lists.sr.ht>; Sun, 23 Jan 2022 07:20:48 +0000 (UTC) Date: Sun, 23 Jan 2022 07:20:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1642922447; bh=njZfzppUql3ge0qiPDCFwMY8fsVCo0Bnw5DaPzBu5e8=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc; b=LhzRKqrhQBM/u2RDvgeFIFAUyjz+oU2SHNTdN9CDfkTQHwT4uEEHlJkaKMOczpRB0 /TaJZraMpCfvIPHCedYx3ggso1m344XqGKr3CAxgu6/kr4L+6bMFQ4XDqtok7oJKcF sH2rWAct1K7dKo9F/SiHjlirJVPytCnYJHvGIEd1uvfTCtU5YXHIXAqFCamT0qDRc9 J27b1peG+sl7/xoNZL3V2MSC6t/W5vCw1RogdzcZ1ylav+oMHhDd8VuPKlMOuwLVY0 6FsXrz7GgifVLMCKFT3iN+SjOHoicpSkpiq3rjvk1TI9nMoxaKKic4HaBLyGg3bsTG DTAK/kM1/7UiA== To: Simon Ser From: Renato Torres Cc: ~emersion/hut-dev@lists.sr.ht Reply-To: Renato Torres Subject: Re: [PATCH v1 0/1] git: show license spike Message-ID: In-Reply-To: References: <20220122233022.1256016-1-renato.torres@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch > I wonder. Maybe a more generally useful feature could be a cat-file > command. Sounds good. > I've been wondering about this, and I'm not sure a Go interface is the=20 > best way to represent a GraphQL interface. (...) I'm checking your suggestions, I have no previous experience with graphql nor gqlclientgen. Just adding extra information. Previouslly I had requested the raw fields and they were empty. For example: query licenseByRepositoryName($name: String!) { repositoryByName(name: $name) { path(path: "LICENSE") { name object { id shortId raw __typename ... on TextBlob { text } } } } } Returns: { "data": { "repositoryByName": { "path": { "name": "LICENSE", "object": { "id": "0ad25db4bd1d86c452db3f9602ccdbe172438f52", "shortId": "0ad25db", "raw": "", "__typename": "TextBlob", "text": " GNU AFFERO GENERAL ..." } } } } } I took a look a the git.sr.ht API and found the following TODO at api/graph/model/object.go: ... func LookupObject(repo *RepoWrapper, hash plumbing.Hash) (Object, error) { =09repo.Lock() =09obj, err :=3D repo.Object(plumbing.AnyObject, hash) =09repo.Unlock() =09if err !=3D nil { =09=09return nil, fmt.Errorf("lookup object %s: %w", hash.String(), err) =09} =09// TODO: Add raw object data, if requested =09switch obj :=3D obj.(type) { =09case *object.Commit: =09=09return CommitFromObject(repo, obj), nil =09case *object.Tree: =09=09return TreeFromObject(repo, obj), nil =09case *object.Blob: =09=09return BlobFromObject(repo, obj), nil =09default: =09=09return nil, fmt.Errorf("Unknown object type %T", obj) =09} } We would need first to add the raw support.=20