Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
content badge
swh:1:cnt:2d378558faf35a21b15bd0d09c85ba69db48f06f

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
import Ajv from 'ajv'
import type { JSONSchemaType } from 'ajv'
import type { Visualization } from '~/plugins/visualization'

/** Schema of a partial visualization entry. */
const schema: JSONSchemaType<Partial<Visualization>> = {
  $schema: 'http://json-schema.org/draft-07/schema#',
  type: 'object',
  properties: {
    uuid: {
      type: 'string',
      nullable: true,
    },
    authors: {
      items: { type: 'string' },
      type: 'array',
      nullable: true,
    },
    displayName: {
      type: 'string',
      nullable: true,
    },
    publishDate: {
      type: 'number',
      nullable: true,
    },
    viewUrl: {
      type: 'string',
      nullable: true,
    },
    downloadUrl: {
      type: 'string',
      nullable: true,
    },
    md5: {
      type: 'string',
      nullable: true,
    },
    phash: {
      type: 'string',
      nullable: true,
    },
    resolution: {
      items: [{ type: 'number' }, { type: 'number' }],
      minItems: 2,
      maxItems: 2,
      type: 'array',
      nullable: true,
    },
    fileSize: {
      type: 'number',
      nullable: true,
    },
    languages: {
      items: { type: 'string' },
      type: 'array',
      nullable: true,
    },
    tags: {
      items: { type: 'string' },
      type: 'array',
      nullable: true,
    },
    abstract: {
      type: 'string',
      nullable: true,
    },
    rights: {
      type: 'string',
      nullable: true,
    },
    source: {
      type: 'object',
      properties: {
        name: { type: 'string' },
        url: { type: 'string' },
        accessDate: { type: 'string' },
      },
      required: ['name', 'url', 'accessDate'],
      additionalProperties: false,
      nullable: true,
    },
  },
  additionalProperties: true,
}

const ajv = new Ajv({ allowUnionTypes: true })

/** Validate the schema of the object storing the new entry. */
const validate = ajv.compile(schema)

export const validateInput = (input: string) => {
  let parsed: object | null = null
  let validJson = false
  let validVisualization = false
  try {
    parsed = JSON.parse(input)
    validJson = true
    validVisualization = validate(parsed)
  }
  catch {}
  return {
    parsed,
    validJson,
    validVisualization,
  }
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API