Skip to content

Conversation

@3096
Copy link

@3096 3096 commented Nov 8, 2025

Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (not applicable: schema-only change, no code path altered)
  • documentation is changed or added (schema description updated)

Description of change

This PR updates docs/schema.yaml so that the fileTest.filetype enum fully reflects all file types that the runtime (system/file.go) can return. Previously, the schema only listed file, symlink, and directory. It now includes:

  • file
  • symlink
  • directory
  • socket
  • character-device
  • block-device
  • pipe

Additionally, the description of the file resource was expanded to enumerate these types.

Motivation:
Tools (IDEs, schema validators, autocomplete) relying on docs/schema.yaml were unaware of valid values like socket, causing false validation errors and poorer authoring experience. Aligning the schema with the runtime improves correctness and usability.

Evidence:
Supported types are returned by DefFile.Filetype() in system/file.go:

	switch {
	case fi.Mode()&os.ModeSymlink == os.ModeSymlink:
		return "symlink", nil
	case fi.Mode()&os.ModeDevice == os.ModeDevice:
		if fi.Mode()&os.ModeCharDevice == os.ModeCharDevice {
			return "character-device", nil
		}
		return "block-device", nil
	case fi.Mode()&os.ModeNamedPipe == os.ModeNamedPipe:
		return "pipe", nil
	case fi.Mode()&os.ModeSocket == os.ModeSocket:
		return "socket", nil
	case fi.IsDir():
		return "directory", nil
	case fi.Mode().IsRegular():
		return "file", nil
	}

📚 Documentation preview 📚: https://goss--1041.org.readthedocs.build/en/1041/

@3096 3096 requested a review from aelsabbahy as a code owner November 8, 2025 00:36
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